reactive-vscode 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/composables/index.d.ts +50 -0
- package/dist/composables/index.mjs +50 -0
- package/dist/composables/useAbsolutePath.d.ts +7 -0
- package/dist/composables/useAbsolutePath.mjs +10 -0
- package/dist/composables/useActiveColorTheme.d.ts +5 -0
- package/dist/composables/useActiveColorTheme.mjs +11 -0
- package/dist/composables/useActiveDebugSession.d.ts +5 -0
- package/dist/composables/useActiveDebugSession.mjs +11 -0
- package/dist/composables/useActiveEditorDecorations.d.ts +8 -0
- package/dist/composables/useActiveEditorDecorations.mjs +6 -0
- package/dist/composables/useActiveNotebookEditor.d.ts +6 -0
- package/dist/composables/useActiveNotebookEditor.mjs +11 -0
- package/dist/composables/useActiveTerminal.d.ts +6 -0
- package/dist/composables/useActiveTerminal.mjs +11 -0
- package/dist/composables/useActiveTextEditor.d.ts +6 -0
- package/dist/composables/useActiveTextEditor.mjs +11 -0
- package/dist/composables/useAllExtensions.d.ts +5 -0
- package/dist/composables/useAllExtensions.mjs +11 -0
- package/dist/composables/useCommand.d.ts +7 -0
- package/dist/composables/useCommand.mjs +5 -0
- package/dist/composables/useCommands.d.ts +7 -0
- package/dist/composables/useCommands.mjs +5 -0
- package/dist/composables/useCommentController.d.ts +5 -0
- package/dist/composables/useCommentController.mjs +5 -0
- package/dist/composables/useDefaultShell.d.ts +4 -0
- package/dist/composables/useDefaultShell.mjs +11 -0
- package/dist/composables/useDisposable.d.ts +7 -0
- package/dist/composables/useDisposable.mjs +7 -0
- package/dist/composables/useDocumentText.d.ts +7 -0
- package/dist/composables/useDocumentText.mjs +14 -0
- package/dist/composables/useEditorDecorations.d.ts +9 -0
- package/dist/composables/useEditorDecorations.mjs +8 -0
- package/dist/composables/useEvent.d.ts +6 -0
- package/dist/composables/useEvent.mjs +8 -0
- package/dist/composables/useEventEmitter.d.ts +10 -0
- package/dist/composables/useEventEmitter.mjs +14 -0
- package/dist/composables/useFetchTasks.d.ts +6 -0
- package/dist/composables/useFetchTasks.mjs +5 -0
- package/dist/composables/useFileUri.d.ts +23 -0
- package/dist/composables/useFileUri.mjs +6 -0
- package/dist/composables/useFoldingRangeProvider.d.ts +6 -0
- package/dist/composables/useFoldingRangeProvider.mjs +21 -0
- package/dist/composables/useIsDarkTheme.d.ts +6 -0
- package/dist/composables/useIsDarkTheme.mjs +8 -0
- package/dist/composables/useIsTelemetryEnabled.d.ts +4 -0
- package/dist/composables/useIsTelemetryEnabled.mjs +11 -0
- package/dist/composables/useL10nText.d.ts +6 -0
- package/dist/composables/useL10nText.mjs +7 -0
- package/dist/composables/useLogLevel.d.ts +5 -0
- package/dist/composables/useLogLevel.mjs +11 -0
- package/dist/composables/useLogger.d.ts +21 -0
- package/dist/composables/useLogger.mjs +31 -0
- package/dist/composables/useNotebookEditorSelection.d.ts +6 -0
- package/dist/composables/useNotebookEditorSelection.mjs +23 -0
- package/dist/composables/useNotebookEditorSelections.d.ts +6 -0
- package/dist/composables/useNotebookEditorSelections.mjs +23 -0
- package/dist/composables/useNotebookEditorVisibleRanges.d.ts +6 -0
- package/dist/composables/useNotebookEditorVisibleRanges.mjs +15 -0
- package/dist/composables/useOpenedTerminals.d.ts +6 -0
- package/dist/composables/useOpenedTerminals.mjs +13 -0
- package/dist/composables/useOutputChannel.d.ts +6 -0
- package/dist/composables/useOutputChannel.mjs +5 -0
- package/dist/composables/useTaskExecutions.d.ts +5 -0
- package/dist/composables/useTaskExecutions.mjs +13 -0
- package/dist/composables/useTerminalState.d.ts +6 -0
- package/dist/composables/useTerminalState.mjs +15 -0
- package/dist/composables/useTextEditorCommand.d.ts +8 -0
- package/dist/composables/useTextEditorCommand.mjs +5 -0
- package/dist/composables/useTextEditorCommands.d.ts +7 -0
- package/dist/composables/useTextEditorCommands.mjs +5 -0
- package/dist/composables/useTextEditorSelection.d.ts +6 -0
- package/dist/composables/useTextEditorSelection.mjs +23 -0
- package/dist/composables/useTextEditorSelections.d.ts +6 -0
- package/dist/composables/useTextEditorSelections.mjs +23 -0
- package/dist/composables/useTextEditorViewColumn.d.ts +6 -0
- package/dist/composables/useTextEditorViewColumn.mjs +15 -0
- package/dist/composables/useTextEditorVisibleRanges.d.ts +6 -0
- package/dist/composables/useTextEditorVisibleRanges.mjs +15 -0
- package/dist/composables/useTreeView.d.ts +13 -0
- package/dist/composables/useTreeView.mjs +25 -0
- package/dist/composables/useTreeViewWithParent.d.ts +12 -0
- package/dist/composables/useTreeViewWithParent.mjs +28 -0
- package/dist/composables/useUri.d.ts +23 -0
- package/dist/composables/useUri.mjs +32 -0
- package/dist/composables/useViewBadge.d.ts +11 -0
- package/dist/composables/useViewBadge.mjs +8 -0
- package/dist/composables/useViewTitle.d.ts +11 -0
- package/dist/composables/useViewTitle.mjs +8 -0
- package/dist/composables/useViewVisibility.d.ts +11 -0
- package/dist/composables/useViewVisibility.mjs +16 -0
- package/dist/composables/useVisibleNotebookEditors.d.ts +6 -0
- package/dist/composables/useVisibleNotebookEditors.mjs +11 -0
- package/dist/composables/useVisibleTextEditors.d.ts +6 -0
- package/dist/composables/useVisibleTextEditors.mjs +11 -0
- package/dist/composables/useVscodeContext.d.ts +4 -0
- package/dist/composables/useVscodeContext.mjs +10 -0
- package/dist/composables/useWebviewView.d.ts +18 -0
- package/dist/composables/useWebviewView.mjs +33 -0
- package/dist/composables/useWindowState.d.ts +7 -0
- package/dist/composables/useWindowState.mjs +14 -0
- package/dist/composables/useWorkspaceFolders.d.ts +5 -0
- package/dist/composables/useWorkspaceFolders.mjs +11 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +73 -0
- package/dist/utils/createKeyedComposable.d.ts +6 -0
- package/dist/utils/createKeyedComposable.mjs +22 -0
- package/dist/utils/createSingletonComposable.d.ts +6 -0
- package/dist/utils/createSingletonComposable.mjs +4 -0
- package/dist/utils/defineConfigs.d.ts +21 -0
- package/dist/utils/defineConfigs.mjs +33 -0
- package/dist/utils/defineExtension.d.ts +15 -0
- package/dist/utils/defineExtension.mjs +20 -0
- package/dist/utils/executeCommand.d.ts +10 -0
- package/dist/utils/executeCommand.mjs +4 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.mjs +9 -0
- package/dist/utils/onActivate.d.ts +13 -0
- package/dist/utils/onActivate.mjs +8 -0
- package/dist/utils/onDeactivate.d.ts +12 -0
- package/dist/utils/onDeactivate.mjs +4 -0
- package/dist/utils/tryOnScopeDispose.d.ts +6 -0
- package/dist/utils/tryOnScopeDispose.mjs +8 -0
- package/dist/utils/types.d.ts +1 -0
- package/dist/utils/types.mjs +0 -0
- package/package.json +49 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export * from './useAbsolutePath';
|
|
2
|
+
export * from './useActiveColorTheme';
|
|
3
|
+
export * from './useActiveDebugSession';
|
|
4
|
+
export * from './useActiveEditorDecorations';
|
|
5
|
+
export * from './useActiveNotebookEditor';
|
|
6
|
+
export * from './useActiveTerminal';
|
|
7
|
+
export * from './useActiveTextEditor';
|
|
8
|
+
export * from './useAllExtensions';
|
|
9
|
+
export * from './useCommand';
|
|
10
|
+
export * from './useCommands';
|
|
11
|
+
export * from './useCommentController';
|
|
12
|
+
export * from './useDefaultShell';
|
|
13
|
+
export * from './useDisposable';
|
|
14
|
+
export * from './useDocumentText';
|
|
15
|
+
export * from './useEditorDecorations';
|
|
16
|
+
export * from './useEvent';
|
|
17
|
+
export * from './useEventEmitter';
|
|
18
|
+
export * from './useFetchTasks';
|
|
19
|
+
export * from './useFileUri';
|
|
20
|
+
export * from './useFoldingRangeProvider';
|
|
21
|
+
export * from './useIsDarkTheme';
|
|
22
|
+
export * from './useIsTelemetryEnabled';
|
|
23
|
+
export * from './useL10nText';
|
|
24
|
+
export * from './useLogLevel';
|
|
25
|
+
export * from './useLogger';
|
|
26
|
+
export * from './useNotebookEditorSelection';
|
|
27
|
+
export * from './useNotebookEditorSelections';
|
|
28
|
+
export * from './useNotebookEditorVisibleRanges';
|
|
29
|
+
export * from './useOpenedTerminals';
|
|
30
|
+
export * from './useOutputChannel';
|
|
31
|
+
export * from './useTaskExecutions';
|
|
32
|
+
export * from './useTerminalState';
|
|
33
|
+
export * from './useTextEditorCommand';
|
|
34
|
+
export * from './useTextEditorCommands';
|
|
35
|
+
export * from './useTextEditorSelection';
|
|
36
|
+
export * from './useTextEditorSelections';
|
|
37
|
+
export * from './useTextEditorViewColumn';
|
|
38
|
+
export * from './useTextEditorVisibleRanges';
|
|
39
|
+
export * from './useTreeView';
|
|
40
|
+
export * from './useTreeViewWithParent';
|
|
41
|
+
export * from './useUri';
|
|
42
|
+
export * from './useViewBadge';
|
|
43
|
+
export * from './useViewTitle';
|
|
44
|
+
export * from './useViewVisibility';
|
|
45
|
+
export * from './useVisibleNotebookEditors';
|
|
46
|
+
export * from './useVisibleTextEditors';
|
|
47
|
+
export * from './useVscodeContext';
|
|
48
|
+
export * from './useWebviewView';
|
|
49
|
+
export * from './useWindowState';
|
|
50
|
+
export * from './useWorkspaceFolders';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export * from "./useAbsolutePath.mjs";
|
|
2
|
+
export * from "./useActiveColorTheme.mjs";
|
|
3
|
+
export * from "./useActiveDebugSession.mjs";
|
|
4
|
+
export * from "./useActiveEditorDecorations.mjs";
|
|
5
|
+
export * from "./useActiveNotebookEditor.mjs";
|
|
6
|
+
export * from "./useActiveTerminal.mjs";
|
|
7
|
+
export * from "./useActiveTextEditor.mjs";
|
|
8
|
+
export * from "./useAllExtensions.mjs";
|
|
9
|
+
export * from "./useCommand.mjs";
|
|
10
|
+
export * from "./useCommands.mjs";
|
|
11
|
+
export * from "./useCommentController.mjs";
|
|
12
|
+
export * from "./useDefaultShell.mjs";
|
|
13
|
+
export * from "./useDisposable.mjs";
|
|
14
|
+
export * from "./useDocumentText.mjs";
|
|
15
|
+
export * from "./useEditorDecorations.mjs";
|
|
16
|
+
export * from "./useEvent.mjs";
|
|
17
|
+
export * from "./useEventEmitter.mjs";
|
|
18
|
+
export * from "./useFetchTasks.mjs";
|
|
19
|
+
export * from "./useFileUri.mjs";
|
|
20
|
+
export * from "./useFoldingRangeProvider.mjs";
|
|
21
|
+
export * from "./useIsDarkTheme.mjs";
|
|
22
|
+
export * from "./useIsTelemetryEnabled.mjs";
|
|
23
|
+
export * from "./useL10nText.mjs";
|
|
24
|
+
export * from "./useLogLevel.mjs";
|
|
25
|
+
export * from "./useLogger.mjs";
|
|
26
|
+
export * from "./useNotebookEditorSelection.mjs";
|
|
27
|
+
export * from "./useNotebookEditorSelections.mjs";
|
|
28
|
+
export * from "./useNotebookEditorVisibleRanges.mjs";
|
|
29
|
+
export * from "./useOpenedTerminals.mjs";
|
|
30
|
+
export * from "./useOutputChannel.mjs";
|
|
31
|
+
export * from "./useTaskExecutions.mjs";
|
|
32
|
+
export * from "./useTerminalState.mjs";
|
|
33
|
+
export * from "./useTextEditorCommand.mjs";
|
|
34
|
+
export * from "./useTextEditorCommands.mjs";
|
|
35
|
+
export * from "./useTextEditorSelection.mjs";
|
|
36
|
+
export * from "./useTextEditorSelections.mjs";
|
|
37
|
+
export * from "./useTextEditorViewColumn.mjs";
|
|
38
|
+
export * from "./useTextEditorVisibleRanges.mjs";
|
|
39
|
+
export * from "./useTreeView.mjs";
|
|
40
|
+
export * from "./useTreeViewWithParent.mjs";
|
|
41
|
+
export * from "./useUri.mjs";
|
|
42
|
+
export * from "./useViewBadge.mjs";
|
|
43
|
+
export * from "./useViewTitle.mjs";
|
|
44
|
+
export * from "./useViewVisibility.mjs";
|
|
45
|
+
export * from "./useVisibleNotebookEditors.mjs";
|
|
46
|
+
export * from "./useVisibleTextEditors.mjs";
|
|
47
|
+
export * from "./useVscodeContext.mjs";
|
|
48
|
+
export * from "./useWebviewView.mjs";
|
|
49
|
+
export * from "./useWindowState.mjs";
|
|
50
|
+
export * from "./useWorkspaceFolders.mjs";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComputedRef, MaybeRefOrGetter } from '@vue/runtime-core';
|
|
2
|
+
/**
|
|
3
|
+
* @category utilities
|
|
4
|
+
* @reactive `ExtensionContext.asAbsolutePath`
|
|
5
|
+
*/
|
|
6
|
+
export declare function useAbsolutePath(relativePath: MaybeRefOrGetter<string>, slient: true): ComputedRef<string | undefined>;
|
|
7
|
+
export declare function useAbsolutePath(relativePath: MaybeRefOrGetter<string>, slient?: false): ComputedRef<string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { computed, toValue } from "@vue/runtime-core";
|
|
2
|
+
import { extensionContext } from "../utils/index.mjs";
|
|
3
|
+
export function useAbsolutePath(relativePath, slient = false) {
|
|
4
|
+
return computed(() => {
|
|
5
|
+
const extCtx = extensionContext.value;
|
|
6
|
+
if (!extCtx && !slient)
|
|
7
|
+
throw new Error("useAbsolutePath() must be called in extension activation callback.");
|
|
8
|
+
return extCtx?.asAbsolutePath(toValue(relativePath));
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { shallowRef } from "@vue/runtime-core";
|
|
2
|
+
import { window } from "vscode";
|
|
3
|
+
import { createSingletonComposable } from "../utils/index.mjs";
|
|
4
|
+
import { useDisposable } from "./useDisposable.mjs";
|
|
5
|
+
export const useActiveColorTheme = createSingletonComposable(() => {
|
|
6
|
+
const result = shallowRef(window.activeColorTheme);
|
|
7
|
+
useDisposable(window.onDidChangeActiveColorTheme((theme) => {
|
|
8
|
+
result.value = theme;
|
|
9
|
+
}));
|
|
10
|
+
return result;
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { computed, shallowRef } from "@vue/runtime-core";
|
|
2
|
+
import { debug } from "vscode";
|
|
3
|
+
import { createSingletonComposable } from "../utils/index.mjs";
|
|
4
|
+
import { useDisposable } from "./useDisposable.mjs";
|
|
5
|
+
export const useActiveDebugSession = createSingletonComposable(() => {
|
|
6
|
+
const session = shallowRef(debug.activeDebugSession);
|
|
7
|
+
useDisposable(debug.onDidChangeActiveDebugSession((ev) => {
|
|
8
|
+
session.value = ev;
|
|
9
|
+
}));
|
|
10
|
+
return computed(() => session.value);
|
|
11
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from '@vue/runtime-core';
|
|
2
|
+
import type { DecorationOptions, DecorationRenderOptions, Range } from 'vscode';
|
|
3
|
+
/**
|
|
4
|
+
* Reactively set decorations on the active editor. See `vscode::window.activeTextEditor`.
|
|
5
|
+
*
|
|
6
|
+
* @category editor
|
|
7
|
+
*/
|
|
8
|
+
export declare function useActiveEditorDecorations(options: DecorationRenderOptions, rangesOrOptions: MaybeRefOrGetter<readonly Range[] | readonly DecorationOptions[]>): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useActiveTextEditor } from "./useActiveTextEditor.mjs";
|
|
2
|
+
import { useEditorDecorations } from "./useEditorDecorations.mjs";
|
|
3
|
+
export function useActiveEditorDecorations(options, rangesOrOptions) {
|
|
4
|
+
const activeEditor = useActiveTextEditor();
|
|
5
|
+
useEditorDecorations(options, activeEditor, rangesOrOptions);
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { shallowRef } from "@vue/runtime-core";
|
|
2
|
+
import { window } from "vscode";
|
|
3
|
+
import { createSingletonComposable } from "../utils/index.mjs";
|
|
4
|
+
import { useDisposable } from "./useDisposable.mjs";
|
|
5
|
+
export const useActiveNotebookEditor = createSingletonComposable(() => {
|
|
6
|
+
const activeNotebookEditor = shallowRef(window.activeNotebookEditor);
|
|
7
|
+
useDisposable(window.onDidChangeActiveNotebookEditor((editor) => {
|
|
8
|
+
activeNotebookEditor.value = editor;
|
|
9
|
+
}));
|
|
10
|
+
return activeNotebookEditor;
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { shallowRef } from "@vue/runtime-core";
|
|
2
|
+
import { window } from "vscode";
|
|
3
|
+
import { createSingletonComposable } from "../utils/index.mjs";
|
|
4
|
+
import { useDisposable } from "./useDisposable.mjs";
|
|
5
|
+
export const useActiveTerminal = createSingletonComposable(() => {
|
|
6
|
+
const activeTerminal = shallowRef(window.activeTerminal);
|
|
7
|
+
useDisposable(window.onDidChangeActiveTerminal((terminal) => {
|
|
8
|
+
activeTerminal.value = terminal;
|
|
9
|
+
}));
|
|
10
|
+
return activeTerminal;
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { shallowRef } from "@vue/runtime-core";
|
|
2
|
+
import { window } from "vscode";
|
|
3
|
+
import { createSingletonComposable } from "../utils/index.mjs";
|
|
4
|
+
import { useDisposable } from "./useDisposable.mjs";
|
|
5
|
+
export const useActiveTextEditor = createSingletonComposable(() => {
|
|
6
|
+
const activeTextEditor = shallowRef(window.activeTextEditor);
|
|
7
|
+
useDisposable(window.onDidChangeActiveTextEditor((editor) => {
|
|
8
|
+
activeTextEditor.value = editor;
|
|
9
|
+
}));
|
|
10
|
+
return activeTextEditor;
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { computed, shallowRef } from "@vue/runtime-core";
|
|
2
|
+
import { extensions } from "vscode";
|
|
3
|
+
import { createSingletonComposable } from "../utils/index.mjs";
|
|
4
|
+
import { useDisposable } from "./useDisposable.mjs";
|
|
5
|
+
export const useAllExtensions = createSingletonComposable(() => {
|
|
6
|
+
const allExtensions = shallowRef(extensions.all);
|
|
7
|
+
useDisposable(extensions.onDidChange(() => {
|
|
8
|
+
allExtensions.value = extensions.all;
|
|
9
|
+
}));
|
|
10
|
+
return computed(() => allExtensions.value);
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { computed, shallowRef } from "@vue/runtime-core";
|
|
2
|
+
import { env } from "vscode";
|
|
3
|
+
import { createSingletonComposable } from "../utils/index.mjs";
|
|
4
|
+
import { useDisposable } from "./useDisposable.mjs";
|
|
5
|
+
export const useDefaultShell = createSingletonComposable(() => {
|
|
6
|
+
const defaultShell = shallowRef(env.shell);
|
|
7
|
+
useDisposable(env.onDidChangeShell((ev) => {
|
|
8
|
+
defaultShell.value = ev;
|
|
9
|
+
}));
|
|
10
|
+
return computed(() => defaultShell.value);
|
|
11
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getCurrentScope } from "@vue/runtime-core";
|
|
2
|
+
import { extensionScope } from "../utils/index.mjs";
|
|
3
|
+
export function useDisposable(disposable) {
|
|
4
|
+
const scope = getCurrentScope() ?? extensionScope;
|
|
5
|
+
scope.cleanups.push(disposable.dispose.bind(disposable));
|
|
6
|
+
return disposable;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from '@vue/runtime-core';
|
|
2
|
+
import type { TextDocument } from 'vscode';
|
|
3
|
+
/**
|
|
4
|
+
* @reactive `TextDocument.getText`
|
|
5
|
+
* @category document
|
|
6
|
+
*/
|
|
7
|
+
export declare function useDocumentText(doc: MaybeRefOrGetter<TextDocument | undefined>): import("@vue/reactivity").ShallowRef<string | undefined>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { shallowRef, toValue, watchEffect } from "@vue/runtime-core";
|
|
2
|
+
import { workspace } from "vscode";
|
|
3
|
+
import { useDisposable } from "./useDisposable.mjs";
|
|
4
|
+
export function useDocumentText(doc) {
|
|
5
|
+
const text = shallowRef(toValue(doc)?.getText());
|
|
6
|
+
watchEffect(() => {
|
|
7
|
+
text.value = toValue(doc)?.getText();
|
|
8
|
+
});
|
|
9
|
+
useDisposable(workspace.onDidChangeTextDocument((ev) => {
|
|
10
|
+
if (ev.document === toValue(doc))
|
|
11
|
+
text.value = ev.document.getText();
|
|
12
|
+
}));
|
|
13
|
+
return text;
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from '@vue/runtime-core';
|
|
2
|
+
import type { DecorationOptions, DecorationRenderOptions, Range, TextEditor } from 'vscode';
|
|
3
|
+
import type { Nullable } from '../utils/types';
|
|
4
|
+
/**
|
|
5
|
+
* Reactively set decorations on the given editor. See `vscode::TextEditor.setDecorations`.
|
|
6
|
+
*
|
|
7
|
+
* @category editor
|
|
8
|
+
*/
|
|
9
|
+
export declare function useEditorDecorations(options: DecorationRenderOptions, editor: MaybeRefOrGetter<Nullable<TextEditor>>, rangesOrOptions: MaybeRefOrGetter<readonly Range[] | readonly DecorationOptions[]>): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { toValue, watchEffect } from "@vue/runtime-core";
|
|
2
|
+
import { window } from "vscode";
|
|
3
|
+
export function useEditorDecorations(options, editor, rangesOrOptions) {
|
|
4
|
+
const decorationType = window.createTextEditorDecorationType(options);
|
|
5
|
+
watchEffect(() => {
|
|
6
|
+
toValue(editor)?.setDecorations(decorationType, toValue(rangesOrOptions));
|
|
7
|
+
});
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="vscode" />
|
|
2
|
+
/**
|
|
3
|
+
* @category utilities
|
|
4
|
+
* @reactive `EventEmitter`
|
|
5
|
+
*/
|
|
6
|
+
export declare function useEventEmitter<T>(listeners?: ((e: T) => any)[]): {
|
|
7
|
+
event: import("vscode").Event<T>;
|
|
8
|
+
fire: any;
|
|
9
|
+
addListener: import("vscode").Event<T>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EventEmitter } from "vscode";
|
|
2
|
+
import { useDisposable } from "./useDisposable.mjs";
|
|
3
|
+
import { useEvent } from "./useEvent.mjs";
|
|
4
|
+
export function useEventEmitter(listeners = []) {
|
|
5
|
+
const emitter = useDisposable(new EventEmitter());
|
|
6
|
+
const addListener = useEvent(emitter.event, listeners);
|
|
7
|
+
for (const listener of listeners)
|
|
8
|
+
addListener(listener);
|
|
9
|
+
return {
|
|
10
|
+
event: emitter.event,
|
|
11
|
+
fire: emitter.fire.bind(emitter),
|
|
12
|
+
addListener
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from '@vue/runtime-core';
|
|
2
|
+
import type { TaskFilter } from 'vscode';
|
|
3
|
+
/**
|
|
4
|
+
* @reactive `tasks.fetchTasks`
|
|
5
|
+
*/
|
|
6
|
+
export declare function useFetchTasks(filter?: MaybeRefOrGetter<TaskFilter | undefined>): import("@vue/reactivity").ComputedRef<Thenable<import("vscode").Task[]>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from '@vue/runtime-core';
|
|
2
|
+
import { Uri } from 'vscode';
|
|
3
|
+
/**
|
|
4
|
+
* @reactive `Uri.file`
|
|
5
|
+
* @category utilities
|
|
6
|
+
*/
|
|
7
|
+
export declare function useFileUri(path: MaybeRefOrGetter<string>): import("@vue/reactivity").ShallowReactive<{
|
|
8
|
+
readonly scheme: string;
|
|
9
|
+
readonly authority: string;
|
|
10
|
+
readonly path: string;
|
|
11
|
+
readonly query: string;
|
|
12
|
+
readonly fragment: string;
|
|
13
|
+
readonly fsPath: string;
|
|
14
|
+
with(change: {
|
|
15
|
+
scheme?: string | undefined;
|
|
16
|
+
authority?: string | undefined;
|
|
17
|
+
path?: string | undefined;
|
|
18
|
+
query?: string | undefined;
|
|
19
|
+
fragment?: string | undefined;
|
|
20
|
+
}): Uri;
|
|
21
|
+
toString(): string;
|
|
22
|
+
toJSON(): any;
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from '@vue/runtime-core';
|
|
2
|
+
import type { DocumentSelector, FoldingRangeProvider } from 'vscode';
|
|
3
|
+
/**
|
|
4
|
+
* @reactive `languages.registerFoldingRangeProvider`
|
|
5
|
+
*/
|
|
6
|
+
export declare function useFoldingRangeProvider(selector: DocumentSelector, provideFoldingRanges: MaybeRefOrGetter<FoldingRangeProvider['provideFoldingRanges']>): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { shallowRef, toValue, watchEffect } from "@vue/runtime-core";
|
|
2
|
+
import { EventEmitter, languages } from "vscode";
|
|
3
|
+
import { useDisposable } from "./useDisposable.mjs";
|
|
4
|
+
export function useFoldingRangeProvider(selector, provideFoldingRanges) {
|
|
5
|
+
const changeEventEmitter = new EventEmitter();
|
|
6
|
+
const provideFn = shallowRef();
|
|
7
|
+
watchEffect(() => {
|
|
8
|
+
if (provideFn.value)
|
|
9
|
+
changeEventEmitter.fire();
|
|
10
|
+
provideFn.value = toValue(provideFoldingRanges);
|
|
11
|
+
});
|
|
12
|
+
useDisposable(languages.registerFoldingRangeProvider(
|
|
13
|
+
selector,
|
|
14
|
+
{
|
|
15
|
+
onDidChangeFoldingRanges: changeEventEmitter.event,
|
|
16
|
+
provideFoldingRanges(document, context, token) {
|
|
17
|
+
return provideFn.value?.(document, context, token);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
));
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { computed } from "@vue/runtime-core";
|
|
2
|
+
import { ColorThemeKind } from "vscode";
|
|
3
|
+
import { createSingletonComposable } from "../utils/index.mjs";
|
|
4
|
+
import { useActiveColorTheme } from "./useActiveColorTheme.mjs";
|
|
5
|
+
export const useIsDarkTheme = createSingletonComposable(() => {
|
|
6
|
+
const theme = useActiveColorTheme();
|
|
7
|
+
return computed(() => theme.value.kind === ColorThemeKind.Dark || theme.value.kind === ColorThemeKind.HighContrast);
|
|
8
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { computed, shallowRef } from "@vue/runtime-core";
|
|
2
|
+
import { env } from "vscode";
|
|
3
|
+
import { createSingletonComposable } from "../utils/index.mjs";
|
|
4
|
+
import { useDisposable } from "./useDisposable.mjs";
|
|
5
|
+
export const useIsTelemetryEnabled = createSingletonComposable(() => {
|
|
6
|
+
const isTelemetryEnabled = shallowRef(env.isTelemetryEnabled);
|
|
7
|
+
useDisposable(env.onDidChangeTelemetryEnabled((ev) => {
|
|
8
|
+
isTelemetryEnabled.value = ev;
|
|
9
|
+
}));
|
|
10
|
+
return computed(() => isTelemetryEnabled.value);
|
|
11
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComputedRef, MaybeRefOrGetter } from '@vue/runtime-core';
|
|
2
|
+
/**
|
|
3
|
+
* @reactive `l10n.t`
|
|
4
|
+
*/
|
|
5
|
+
export declare function useL10nText(message: MaybeRefOrGetter<string>, ...args: Array<MaybeRefOrGetter<string | number | boolean>>): ComputedRef<string>;
|
|
6
|
+
export declare function useL10nText(message: MaybeRefOrGetter<string>, args: Record<string, any>): ComputedRef<string>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { computed, toRaw, toValue } from "@vue/runtime-core";
|
|
2
|
+
import { l10n } from "vscode";
|
|
3
|
+
export function useL10nText(message, ...args) {
|
|
4
|
+
return computed(() => {
|
|
5
|
+
return typeof args[0] === "object" ? l10n.t(toValue(message), toRaw(args[0])) : l10n.t(toValue(message), ...args.map(toValue));
|
|
6
|
+
});
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { computed, shallowRef } from "@vue/runtime-core";
|
|
2
|
+
import { env } from "vscode";
|
|
3
|
+
import { createSingletonComposable } from "../utils/index.mjs";
|
|
4
|
+
import { useDisposable } from "./useDisposable.mjs";
|
|
5
|
+
export const useLogLevel = createSingletonComposable(() => {
|
|
6
|
+
const logLevel = shallowRef(env.logLevel);
|
|
7
|
+
useDisposable(env.onDidChangeLogLevel((ev) => {
|
|
8
|
+
logLevel.value = ev;
|
|
9
|
+
}));
|
|
10
|
+
return computed(() => logLevel.value);
|
|
11
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="vscode" />
|
|
2
|
+
declare function defaultGetPrefix(type: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Creates a logger that writes to the output channel.
|
|
5
|
+
*
|
|
6
|
+
* @category view
|
|
7
|
+
*/
|
|
8
|
+
export declare function useLogger(name: string, getPrefix?: typeof defaultGetPrefix): {
|
|
9
|
+
outputChannel: import("vscode").OutputChannel;
|
|
10
|
+
createLoggerFunc: (type: string) => (...message: any[]) => void;
|
|
11
|
+
info: (...message: any[]) => void;
|
|
12
|
+
warn: (...message: any[]) => void;
|
|
13
|
+
error: (...message: any[]) => void;
|
|
14
|
+
append: any;
|
|
15
|
+
appendLine: any;
|
|
16
|
+
replace: any;
|
|
17
|
+
clear: any;
|
|
18
|
+
show: any;
|
|
19
|
+
hide: any;
|
|
20
|
+
};
|
|
21
|
+
export {};
|