How to use typescript-language-server - 4 common examples

To help you get started, we’ve selected a few typescript-language-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse-theia / theia / packages / typescript / src / browser / typescript-frontend-contribution.ts View on Github external
QuickPickService, KeybindingRegistry, KeybindingContribution, QuickPickItem, StorageService, LabelProvider, FrontendApplicationContribution, StatusBar, StatusBarAlignment
} from '@theia/core/lib/browser';
import { ExecuteCommandRequest } from '@theia/languages/lib/browser';
import { FileSystemWatcher, FileMoveEvent } from '@theia/filesystem/lib/browser';
import { EditorManager, EditorWidget, EDITOR_CONTEXT_MENU, TextEditor } from '@theia/editor/lib/browser';
import { CommandContribution, CommandRegistry, Command, MenuModelRegistry, MenuContribution, DisposableCollection } from '@theia/core/lib/common';
import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
import { TYPESCRIPT_LANGUAGE_ID, TS_JS_LANGUAGES } from '../common';
import { TypeScriptClientContribution, TypescriptContributionData } from './typescript-client-contribution';
import { TypeScriptKeybindingContexts } from './typescript-keybinding-contexts';
import { TypescriptVersion } from '../common/typescript-version-service';
import URI from '@theia/core/lib/common/uri';

export namespace TypeScriptCommands {
    export const applyCompletionCodeAction: Command = {
        id: Commands.APPLY_COMPLETION_CODE_ACTION
    };
    // TODO: get rid of me when https://github.com/TypeFox/monaco-languageclient/issues/104 is resolved
    export const organizeImports: Command = {
        category: 'TypeScript',
        label: 'Organize Imports',
        id: 'typescript.edit.organizeImports'
    };
    export const openServerLog: Command = {
        category: 'TypeScript',
        label: 'Open Server Log',
        id: 'typescript.server.openLog'
    };
    export const selectVersion: Command = {
        category: 'TypeScript',
        label: 'Select Version',
        id: 'typescript.selectVersion'
github eclipse-theia / theia / packages / typescript / src / browser / typescript-frontend-contribution.ts View on Github external
protected async applyCodeAction(codeAction: tsp.CodeAction): Promise {
        const client = await this.clientContribution.languageClient;
        return client.sendRequest(ExecuteCommandRequest.type, {
            command: Commands.APPLY_CODE_ACTION,
            arguments: [codeAction]
        });
    }
github eclipse-theia / theia / packages / typescript / src / browser / typescript-frontend-contribution.ts View on Github external
protected async renameFile({ sourceUri, targetUri }: FileMoveEvent): Promise {
        const client = await this.clientContribution.languageClient;
        return client.sendRequest(ExecuteCommandRequest.type, {
            command: Commands.APPLY_RENAME_FILE,
            arguments: [{
                sourceUri: sourceUri.toString(),
                targetUri: targetUri.toString()
            }]
        });
    }
github theia-ide / typescript-language-server / example / src / client.ts View on Github external
languageClient.onReady().then(() => {
            languageClient.onRequest(TypeScriptRenameRequest.type, params => {
                editor.setPosition(p2m.asPosition(params.position));
                editor.trigger('', 'editor.action.rename', {});
            });
        });
        const disposable = languageClient.start();

typescript-language-server

Language Server Protocol (LSP) implementation for TypeScript using tsserver

Apache-2.0
Latest version published 2 months ago

Package Health Score

84 / 100
Full package analysis

Similar packages