Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'
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]
});
}
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()
}]
});
}
languageClient.onReady().then(() => {
languageClient.onRequest(TypeScriptRenameRequest.type, params => {
editor.setPosition(p2m.asPosition(params.position));
editor.trigger('', 'editor.action.rename', {});
});
});
const disposable = languageClient.start();