| 1 | import { defineExtension } from 'reactive-vscode' |
| 2 | import { useCommands } from './commands' |
| 3 | import { useLanguageClient } from './languageClient' |
| 4 | import { useLmTools } from './lmTools' |
| 5 | import { activeEntry, useProjects } from './projects' |
| 6 | import { useAnnotations } from './views/annotations' |
| 7 | import { useFoldings } from './views/foldings' |
| 8 | import { logger } from './views/logger' |
| 9 | import { usePreviewWebview } from './views/previewWebview' |
| 10 | import { useProjectsTree } from './views/projectsTree' |
| 11 | import { useSlidesTree } from './views/slidesTree' |
| 12 | |
| 13 | const { activate, deactivate } = defineExtension(() => { |
| 14 | // states |
| 15 | useProjects() |
| 16 | |
| 17 | // commands |
| 18 | useCommands() |
| 19 | |
| 20 | // views |
| 21 | useProjectsTree() |
| 22 | useSlidesTree() |
| 23 | usePreviewWebview() |
| 24 | useAnnotations() |
| 25 | useFoldings() |
| 26 | |
| 27 | // language server |
| 28 | const labsInfo = useLanguageClient() |
| 29 | |
| 30 | // language model tools. Wrap in try-catch for older vscode versions that do not support it. |
| 31 | try { |
| 32 | useLmTools() |
| 33 | } |
| 34 | catch (e) { |
| 35 | logger.warn(`Failed to initialize language model tools: ${e}`) |
| 36 | } |
| 37 | |
| 38 | logger.info('Slidev activated.') |
| 39 | logger.info(`Entry: ${activeEntry.value}`) |
| 40 | |
| 41 | return labsInfo |
| 42 | }) |
| 43 | |
| 44 | export { activate, deactivate } |
| 45 |