vscode#DocumentSelector TypeScript Examples

The following examples show how to use vscode#DocumentSelector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: holes.ts    From vscode-lean4 with Apache License 2.0 6 votes vote down vote up
constructor(private server: Server, private leanDocs: DocumentSelector) {
        this.subscriptions.push(
            this.collection = languages.createDiagnosticCollection('lean holes'),
            commands.registerCommand(this.executeHoleCommand, (file, line, column, action) =>
                this.execute(file, line, column, action)),
            languages.registerCodeActionsProvider(this.leanDocs, this),
            window.onDidChangeVisibleTextEditors(() => this.refresh()),
            this.server.statusChanged.on(() => this.refresh()),
        );
    }
Example #2
Source File: languageFeatures.ts    From vscode-todo-md with MIT License 6 votes vote down vote up
/**
 * Return selector targeting files this extension activates on
 * (for language features).
 */
export function getTodoMdFileDocumentSelector(): DocumentSelector {
	return {
		scheme: 'file',
		pattern: $config.activatePattern,
	};
}
Example #3
Source File: extension.ts    From svlangserver with MIT License 5 votes vote down vote up
selector: DocumentSelector = [
    { scheme: 'file', language: 'systemverilog' },
    { scheme: 'file', language: 'verilog' }
]
Example #4
Source File: infoview.ts    From vscode-lean4 with Apache License 2.0 5 votes vote down vote up
constructor(private provider: LeanClientProvider, private readonly leanDocs: DocumentSelector, private context: ExtensionContext) {
        this.clientProvider = provider;
        this.updateStylesheet();

        provider.clientAdded((client) => {
            void this.onClientAdded(client);
        });

        provider.clientRemoved((client) => {
            void this.onClientRemoved(client);
        });

        provider.clientStopped(([client, activeClient, err]) => {
            void this.onActiveClientStopped(client, activeClient, err);

        });

        this.subscriptions.push(
            window.onDidChangeActiveTextEditor(() => this.sendPosition()),
            window.onDidChangeTextEditorSelection(() => this.sendPosition()),
            workspace.onDidChangeConfiguration(async (_e) => {
                // regression; changing the style needs a reload. :/
                this.updateStylesheet();
                await this.sendConfig();
            }),
            workspace.onDidChangeTextDocument(async () => {
                await this.sendPosition();
            }),
            commands.registerTextEditorCommand('lean4.displayGoal', (editor) => this.openPreview(editor)),
            commands.registerTextEditorCommand('lean4.displayList', async (editor) => {
                await this.openPreview(editor);
                await this.webviewPanel?.api.requestedAction({kind: 'toggleAllMessages'});
            }),
            commands.registerTextEditorCommand('lean4.infoView.copyToComment',
                () => this.webviewPanel?.api.requestedAction({kind: 'copyToComment'})),
            commands.registerCommand('lean4.infoView.toggleUpdating', () =>
                this.webviewPanel?.api.requestedAction({kind: 'togglePaused'})),
            commands.registerTextEditorCommand('lean4.infoView.toggleStickyPosition',
                () => this.webviewPanel?.api.requestedAction({kind: 'togglePin'})),
        );
    }