From d992ae8fa59c2145100fa23adbf4bbaa381ad50c Mon Sep 17 00:00:00 2001 From: Josh Pinkney Date: Tue, 17 Dec 2019 15:37:02 +0000 Subject: [PATCH 01/12] Added extension testing Signed-off-by: Josh Pinkney --- che-theia-init-sources.yml | 2 + .../.gitignore | 1 + .../package.json | 47 ++ .../src/browser/languages-test-api.ts | 180 +++++++ .../src/browser/languages-test-main.ts | 195 ++++++++ .../src/browser/plugin-handle-registry.ts | 90 ++++ .../src/browser/test-api-provider.ts | 24 + .../testservice-api-frontend-provider.ts | 47 ++ .../testservice-ext-frontend-module.ts | 29 ++ .../src/common/test-protocol.ts | 92 ++++ .../src/node/testservice-api-node-provider.ts | 67 +++ .../node/testservice-ext-backend-module.ts | 18 + .../src/plugin/testservice-api.ts | 148 ++++++ .../src/testservice-plugin-api-provider.ts | 28 ++ .../tsconfig.json | 17 + .../webpack.config.js | 49 ++ .../package.json | 36 ++ .../src/testing-service.d.ts | 97 ++++ .../tsconfig.json | 14 + yarn.lock | 462 +++++++++++++++++- 20 files changed, 1617 insertions(+), 26 deletions(-) create mode 100644 extensions/eclipse-che-theia-testing-service-ext/.gitignore create mode 100644 extensions/eclipse-che-theia-testing-service-ext/package.json create mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts create mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts create mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/browser/plugin-handle-registry.ts create mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/browser/test-api-provider.ts create mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-api-frontend-provider.ts create mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-ext-frontend-module.ts create mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts create mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-api-node-provider.ts create mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-ext-backend-module.ts create mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts create mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/testservice-plugin-api-provider.ts create mode 100644 extensions/eclipse-che-theia-testing-service-ext/tsconfig.json create mode 100644 extensions/eclipse-che-theia-testing-service-ext/webpack.config.js create mode 100644 extensions/eclipse-che-theia-testing-service/package.json create mode 100644 extensions/eclipse-che-theia-testing-service/src/testing-service.d.ts create mode 100644 extensions/eclipse-che-theia-testing-service/tsconfig.json diff --git a/che-theia-init-sources.yml b/che-theia-init-sources.yml index 22f62d725..91a41fa12 100644 --- a/che-theia-init-sources.yml +++ b/che-theia-init-sources.yml @@ -12,6 +12,8 @@ sources: - extensions/eclipse-che-theia-about - extensions/eclipse-che-theia-preferences-provider-extension - extensions/eclipse-che-theia-git-provisioner + - extensions/eclipse-che-theia-testing-service-ext + - extensions/eclipse-che-theia-testing-service plugins: - plugins/containers-plugin - plugins/workspace-plugin diff --git a/extensions/eclipse-che-theia-testing-service-ext/.gitignore b/extensions/eclipse-che-theia-testing-service-ext/.gitignore new file mode 100644 index 000000000..a65b41774 --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/.gitignore @@ -0,0 +1 @@ +lib diff --git a/extensions/eclipse-che-theia-testing-service-ext/package.json b/extensions/eclipse-che-theia-testing-service-ext/package.json new file mode 100644 index 000000000..76d3a1ead --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/package.json @@ -0,0 +1,47 @@ +{ + "name": "@eclipse-che/testing-service-ext", + "version": "0.0.1", + "description": "Theia - TestService Extension", + "dependencies": { + "@theia/plugin": "^0.15.0", + "@theia/plugin-ext": "^0.15.0", + "@eclipse-che/testing-service": "^0.0.1", + "glob": "^7.1.6", + "mocha": "^3.4.2" + }, + "publishConfig": { + "access": "public" + }, + "theiaExtensions": [ + { + "backend": "lib/node/testservice-ext-backend-module", + "frontend": "lib/browser/testservice-ext-frontend-module" + } + ], + "keywords": [ + "theia-extension" + ], + "license": "EPL-2.0", + "files": [ + "lib", + "src" + ], + "scripts": { + "prepare": "yarn clean && yarn build", + "clean": "rimraf lib", + "format": "tsfmt -r --useTsfmt ../../configs/tsfmt.json", + "lint": "tslint -c ../../configs/tslint.json --project tsconfig.json", + "compile": "tsc", + "build": "concurrently -n \"format,lint,compile\" -c \"red,green,blue\" \"yarn format\" \"yarn lint\" \"yarn compile\" && yarn run compileWorker", + "compileWorker": "webpack-cli --config webpack.config.js", + "watch": "tsc -w" + }, + "devDependencies": { + "clean-webpack-plugin": "^0.1.19", + "ts-loader": "^4.1.0", + "webpack": "^4.20.2", + "webpack-cli": "^3.1.1", + "typescript-formatter": "7.2.2", + "@types/js-yaml": "3.11.2" + } +} \ No newline at end of file diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts new file mode 100644 index 000000000..8c593e32a --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts @@ -0,0 +1,180 @@ +/********************************************************************* + * Copyright (c) 2020 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import { PluginHandleRegistry } from './plugin-handle-registry'; +import { interfaces } from 'inversify'; +import { TestAPI } from '../common/test-protocol'; +import { + CompletionContext, + CompletionResultDto, + SignatureHelp, + Hover, + DocumentHighlight, + Range, + TextEdit, + FormattingOptions, + Definition, + DefinitionLink, + DocumentLink, + CodeLensSymbol, + DocumentSymbol, + ReferenceContext, + Location, + SignatureHelpContext, + CodeActionContext, + CodeAction, + FoldingRange, +} from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; +import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; +import { CancellationToken, FoldingContext } from '@theia/plugin'; +import { SymbolInformation } from 'vscode-languageserver-types'; +import { + Position, + Selection, + RawColorInfo, + WorkspaceEditDto +} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; + +/** + * This class redirects language api requests to the correct sidecars and returns the results + */ +export class TestAPIImpl implements TestAPI { + + private readonly pluginHandleRegistry: PluginHandleRegistry; + + constructor(container: interfaces.Container) { + this.pluginHandleRegistry = container.get(PluginHandleRegistry); + } + + async $provideCompletionItems(pluginID: string, resource: UriComponents, position: Position, + context: CompletionContext, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'completion'); + return languagesExt.$provideCompletionItems(handle, resource, position, context, token); + } + + async $provideDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'definition'); + return languagesExt.$provideDefinition(handle, resource, position, token); + } + + async $provideDeclaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'declaration'); + return languagesExt.$provideDeclaration(handle, resource, position, token); + } + + async $provideSignatureHelp(pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: CancellationToken + ): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'signatureHelp'); + return languagesExt.$provideSignatureHelp(handle, resource, position, context, token); + } + + async $provideImplementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'implementation'); + return languagesExt.$provideImplementation(handle, resource, position, token); + } + + async $provideTypeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'typeDefinition'); + return languagesExt.$provideTypeDefinition(handle, resource, position, token); + } + + async $provideHover(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'hover'); + return languagesExt.$provideHover(handle, resource, position, token); + } + + async $provideDocumentHighlights(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentHighlight'); + return languagesExt.$provideDocumentHighlights(handle, resource, position, token); + } + + $provideWorkspaceSymbols(pluginID: string, query: string, token: CancellationToken): PromiseLike { + return this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'workspaceSymbols').then(({ languagesExt, handle }) => + languagesExt.$provideWorkspaceSymbols(handle, query, token) + ); + } + + async $provideDocumentFormattingEdits(pluginID: string, resource: UriComponents, + options: FormattingOptions, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentFormattingEdits'); + return languagesExt.$provideDocumentFormattingEdits(handle, resource, options, token); + } + + // tslint:disable-next-line:no-any + async $provideDocumentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, + options: FormattingOptions, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentRangeFormattingEdits'); + return languagesExt.$provideDocumentRangeFormattingEdits(handle, resource, range, options, token); + } + + async $provideOnTypeFormattingEdits(pluginID: string, + resource: UriComponents, + position: Position, + ch: string, + options: FormattingOptions, + token: CancellationToken + ): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'onTypeFormattingEdits'); + return languagesExt.$provideOnTypeFormattingEdits(handle, resource, position, ch, options, token); + } + + async $provideDocumentLinks(pluginID: string, resource: UriComponents, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentLinks'); + return languagesExt.$provideDocumentLinks(handle, resource, token); + } + + // tslint:disable-next-line:no-any + async $provideCodeActions(pluginID: string, + resource: UriComponents, + rangeOrSelection: Range | Selection, + context: CodeActionContext, + token: CancellationToken + ): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'codeActions'); + return languagesExt.$provideCodeActions(handle, resource, rangeOrSelection, context, token); + } + + async $provideCodeLenses(pluginID: string, resource: UriComponents, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'codeLenses'); + return languagesExt.$provideCodeLenses(handle, resource, token); + } + + async $provideReferences(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'references'); + return languagesExt.$provideReferences(handle, resource, position, context, token); + } + + $provideDocumentColors(pluginID: string, resource: UriComponents, token: CancellationToken): PromiseLike { + return this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentColors').then(({ languagesExt, handle }) => + languagesExt.$provideDocumentColors(handle, resource, token) + ); + } + + $provideFoldingRange(pluginID: string, + resource: UriComponents, + context: FoldingContext, + token: CancellationToken + ): PromiseLike { + return this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'foldingRange').then(({ languagesExt, handle }) => + languagesExt.$provideFoldingRange(handle, resource, context, token) + ); + } + + $provideRenameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: CancellationToken): PromiseLike { + return this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'renameEdits').then(({ languagesExt, handle }) => + languagesExt.$provideRenameEdits(handle, resource, position, newName, token) + ); + } + + async $provideDocumentSymbols(pluginID: string, resource: UriComponents, token: CancellationToken): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'symbols'); + return languagesExt.$provideDocumentSymbols(handle, resource, token); + } +} diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts new file mode 100644 index 000000000..9abadfd74 --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts @@ -0,0 +1,195 @@ +/********************************************************************* + * Copyright (c) 2020 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import { injectable, inject } from 'inversify'; +import { PluginInfo, LanguagesExt, MAIN_RPC_CONTEXT } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; +import { SerializedDocumentFilter, MarkerData } from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; +import { LanguagesMainImpl } from '@theia/plugin-ext/lib/main/browser/languages-main'; +import * as theia from '@theia/plugin'; +import { PluginHandleRegistry } from './plugin-handle-registry'; +import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import { LanguagesMain, SerializedLanguageConfiguration } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; +import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; + +export type LanguageServerAction = string; +export type LanguageServerActions = + 'completion' | + 'definition' | + 'declaration' | + 'signatureHelp' | + 'implementation' | + 'typeDefinition' | + 'hover' | + 'quickFix' | + 'documentHighlight' | + 'workspaceSymbols' | + 'documentFormattingEdits' | + 'documentRangeFormattingEdits' | + 'onTypeFormattingEdits' | + 'documentLinks' | + 'codeActions' | + 'codeLenses' | + 'references' | + 'symbols' | + 'documentColors' | + 'foldingRange' | + 'renameEdits'; + +@injectable() +export class LanguagesMainTestImpl implements LanguagesMain { + + @inject(LanguagesMainImpl) + private readonly languagesMainImpl: LanguagesMainImpl; + + @inject(PluginHandleRegistry) + private readonly pluginHandleRegistry: PluginHandleRegistry; + + private readonly languagesExtProxy: LanguagesExt; + + constructor(@inject(RPCProtocol) rpc: RPCProtocol) { + this.languagesExtProxy = rpc.getProxy(MAIN_RPC_CONTEXT.LANGUAGES_EXT); + } + + $getLanguages(): Promise { + return this.languagesMainImpl.$getLanguages(); + } + + $changeLanguage(resource: UriComponents, languageId: string): Promise { + return this.languagesMainImpl.$changeLanguage(resource, languageId); + } + + $setLanguageConfiguration(handle: number, languageId: string, configuration: SerializedLanguageConfiguration): void { + this.languagesMainImpl.$setLanguageConfiguration(handle, languageId, configuration); + } + + $unregister(handle: number): void { + this.languagesMainImpl.$unregister(handle); + } + + $clearDiagnostics(id: string): void { + this.languagesMainImpl.$clearDiagnostics(id); + } + + $changeDiagnostics(id: string, delta: [string, MarkerData[]][]): void { + this.languagesMainImpl.$changeDiagnostics(id, delta); + } + + // tslint:disable-next-line: no-any + $emitCodeLensEvent(eventHandle: number, event?: any): void { + this.languagesMainImpl.$emitCodeLensEvent(eventHandle, event); + } + + $registerCompletionSupport(handle: number, pluginInfo: PluginInfo, + selector: SerializedDocumentFilter[], triggerCharacters: string[], supportsResolveDetails: boolean): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'completion', this.languagesExtProxy); + this.languagesMainImpl.$registerCompletionSupport(handle, pluginInfo, selector, triggerCharacters, supportsResolveDetails); + } + + $registerDefinitionProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'definition', this.languagesExtProxy); + this.languagesMainImpl.$registerDefinitionProvider(handle, pluginInfo, selector); + } + + $registerDeclarationProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'declaration', this.languagesExtProxy); + this.languagesMainImpl.$registerDeclarationProvider(handle, pluginInfo, selector); + } + + $registerReferenceProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'references', this.languagesExtProxy); + this.languagesMainImpl.$registerReferenceProvider(handle, pluginInfo, selector); + } + + $registerSignatureHelpProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[], metadata: theia.SignatureHelpProviderMetadata): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'signatureHelp', this.languagesExtProxy); + this.languagesMainImpl.$registerSignatureHelpProvider(handle, pluginInfo, selector, metadata); + } + + $registerImplementationProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'implementation', this.languagesExtProxy); + this.languagesMainImpl.$registerImplementationProvider(handle, pluginInfo, selector); + } + + $registerTypeDefinitionProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'typeDefinition', this.languagesExtProxy); + this.languagesMainImpl.$registerTypeDefinitionProvider(handle, pluginInfo, selector); + } + + $registerHoverProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'hover', this.languagesExtProxy); + this.languagesMainImpl.$registerHoverProvider(handle, pluginInfo, selector); + } + + $registerQuickFixProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[], codeActionKinds?: string[] | undefined): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'quickFix', this.languagesExtProxy); + this.languagesMainImpl.$registerQuickFixProvider(handle, pluginInfo, selector); + } + + $registerDocumentHighlightProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'documentHighlight', this.languagesExtProxy); + this.languagesMainImpl.$registerDocumentHighlightProvider(handle, pluginInfo, selector); + } + + $registerWorkspaceSymbolProvider(handle: number, pluginInfo: PluginInfo): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'workspaceSymbols', this.languagesExtProxy); + this.languagesMainImpl.$registerWorkspaceSymbolProvider(handle, pluginInfo); + } + + $registerDocumentLinkProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'documentLinks', this.languagesExtProxy); + this.languagesMainImpl.$registerDocumentLinkProvider(handle, pluginInfo, selector); + } + + $registerCodeLensSupport(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[], eventHandle: number): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'codeLenses', this.languagesExtProxy); + this.languagesMainImpl.$registerCodeLensSupport(handle, pluginInfo, selector, eventHandle); + } + + $registerOutlineSupport(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'symbols', this.languagesExtProxy); + this.languagesMainImpl.$registerOutlineSupport(handle, pluginInfo, selector); + } + + $registerDocumentFormattingSupport(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'documentFormattingEdits', this.languagesExtProxy); + this.languagesMainImpl.$registerDocumentFormattingSupport(handle, pluginInfo, selector); + } + + $registerRangeFormattingProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'documentRangeFormattingEdits', this.languagesExtProxy); + this.languagesMainImpl.$registerRangeFormattingProvider(handle, pluginInfo, selector); + } + + $registerOnTypeFormattingProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[], autoFormatTriggerCharacters: string[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'onTypeFormattingEdits', this.languagesExtProxy); + this.languagesMainImpl.$registerOnTypeFormattingProvider(handle, pluginInfo, selector, autoFormatTriggerCharacters); + } + + $registerFoldingRangeProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'foldingRange', this.languagesExtProxy); + this.languagesMainImpl.$registerFoldingRangeProvider(handle, pluginInfo, selector); + } + + $registerDocumentColorProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'documentColors', this.languagesExtProxy); + this.languagesMainImpl.$registerDocumentColorProvider(handle, pluginInfo, selector); + } + + $registerRenameProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[], supportsResolveLocation: boolean): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'renameEdits', this.languagesExtProxy); + this.languagesMainImpl.$registerRenameProvider(handle, pluginInfo, selector, supportsResolveLocation); + } + + $registerCallHierarchyProvider(handle: number, selector: SerializedDocumentFilter[]): void { + // This doesnt have pluginInfo so it cannot register with the pluginHandleRegistry for now + this.languagesMainImpl.$registerCallHierarchyProvider(handle, selector); + } + +} diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/plugin-handle-registry.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/plugin-handle-registry.ts new file mode 100644 index 000000000..f2537ff95 --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/src/browser/plugin-handle-registry.ts @@ -0,0 +1,90 @@ +/********************************************************************* + * Copyright (c) 2020 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import { injectable } from 'inversify'; +import { LanguageServerAction } from './languages-test-main'; +import { LanguagesExt } from '@theia/plugin-ext'; +import { Emitter } from '@theia/core/lib/common/event'; + +export interface LanguageFeatureRegistration { + languagesExtImpl: LanguagesExt; // The languagesExt that registered this plugin in the registry + providerHandles: Map; // A map of language actions to their handle +} + +export interface LanguagesExtHandle { + handle: number; + languagesExt: LanguagesExt; +} + +export interface LanguageRegistrationEvent extends LanguagesExtHandle { + pluginID: string; + action: LanguageServerAction; +} + +/** + * This class keeps a registry of which plugins map to which handle + */ +@injectable() +export class PluginHandleRegistry { + pluginRegistrationMap: Map = new Map(); + + private onRegisteredLanguageFeatureEmitter = new Emitter(); + private onRegisteredLanguageFeature = this.onRegisteredLanguageFeatureEmitter.event; + + private findRegisteredLanguagesExt(pluginID: string, languageServerAction: string): LanguagesExtHandle | undefined { + const languageFeatureRegistration = this.pluginRegistrationMap.get(pluginID); + if (languageFeatureRegistration) { + const correctLanguagesExt = languageFeatureRegistration.languagesExtImpl; + const correctLanguageServerHandle = languageFeatureRegistration.providerHandles.get(languageServerAction); + if (correctLanguageServerHandle) { + return { + handle: correctLanguageServerHandle, + languagesExt: correctLanguagesExt + }; + } + } + return undefined; + } + + lookupLanguagesExtForPluginAndAction(pluginID: string, languageServerAction: LanguageServerAction): Promise { + const registeredLanguagesExt = this.findRegisteredLanguagesExt(pluginID, languageServerAction); + if (!registeredLanguagesExt) { + return new Promise(resolve => { + this.onRegisteredLanguageFeature(newRegistration => { + if (newRegistration.pluginID === pluginID && newRegistration.action === languageServerAction) { + return resolve(newRegistration); + } + }); + }); + } else { + return Promise.resolve(registeredLanguagesExt); + } + } + + registerPluginWithFeatureHandle(handle: number, extensionId: string, newlyRegisteredAction: string, languagesExtProxy: LanguagesExt): void { + let potentialRegistration = this.pluginRegistrationMap.get(extensionId); + if (!potentialRegistration) { + potentialRegistration = { + providerHandles: new Map(), + languagesExtImpl: languagesExtProxy + }; + this.pluginRegistrationMap.set(extensionId, potentialRegistration); + } + potentialRegistration.providerHandles.set(newlyRegisteredAction, handle); + + this.onRegisteredLanguageFeatureEmitter.fire({ + handle, + languagesExt: languagesExtProxy, + pluginID: extensionId, + action: newlyRegisteredAction + }); + } + +} diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/test-api-provider.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/test-api-provider.ts new file mode 100644 index 000000000..f49085aca --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/src/browser/test-api-provider.ts @@ -0,0 +1,24 @@ +/********************************************************************* + * Copyright (c) 2020 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import { MainPluginApiProvider } from '@theia/plugin-ext/lib/common/plugin-ext-api-contribution'; +import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import { injectable, interfaces } from 'inversify'; +import { PLUGIN_RPC_CONTEXT } from '../common/test-protocol'; +import { TestAPIImpl } from './languages-test-api'; + +@injectable() +export class TestApiProvider implements MainPluginApiProvider { + + initialize(rpc: RPCProtocol, container: interfaces.Container): void { + rpc.set(PLUGIN_RPC_CONTEXT.TEST_API_MAIN, new TestAPIImpl(container)); + } + +} diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-api-frontend-provider.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-api-frontend-provider.ts new file mode 100644 index 000000000..53bc1f33c --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-api-frontend-provider.ts @@ -0,0 +1,47 @@ +/********************************************************************* + * Copyright (c) 2020 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import { Plugin, emptyPlugin } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; +import { ExtPluginApiFrontendInitializationFn } from '@theia/plugin-ext/lib/common/plugin-ext-api-contribution'; +import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import * as testService from '@eclipse-che/testing-service'; +import { createAPIFactory } from '../plugin/testservice-api'; + +// tslint:disable-next-line:no-any +const ctx = self as any; +const pluginsApiImpl = new Map(); +let defaultApi: typeof testService; + +export const initializeApi: ExtPluginApiFrontendInitializationFn = (rpc: RPCProtocol, plugins: Map) => { + const TestServiceApiFactory = createAPIFactory(rpc); + const handler = { + // tslint:disable-next-line:no-any + get: (target: any, name: string) => { + const plugin = plugins.get(name); + if (plugin) { + let apiImpl = pluginsApiImpl.get(plugin.model.id); + if (!apiImpl) { + apiImpl = TestServiceApiFactory(plugin); + pluginsApiImpl.set(plugin.model.id, apiImpl); + } + return apiImpl; + } + + if (!defaultApi) { + defaultApi = TestServiceApiFactory(emptyPlugin); + } + + return defaultApi; + } + }; + + // tslint:disable-next-line:no-null-keyword + ctx['test'] = new Proxy(Object.create(null), handler); +}; diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-ext-frontend-module.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-ext-frontend-module.ts new file mode 100644 index 000000000..5f83e49c1 --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-ext-frontend-module.ts @@ -0,0 +1,29 @@ +/********************************************************************* + * Copyright (c) 2020 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import { ContainerModule } from 'inversify'; +import { PluginHandleRegistry } from './plugin-handle-registry'; +import { TestApiProvider } from './test-api-provider'; +import { MainPluginApiProvider, LanguagesMainFactory } from '@theia/plugin-ext'; +import { LanguagesMainTestImpl } from './languages-test-main'; +import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; + +export default new ContainerModule((bind, unbind, isBound, rebind) => { + bind(TestApiProvider).toSelf().inSingletonScope(); + bind(MainPluginApiProvider).toService(TestApiProvider); + + bind(PluginHandleRegistry).toSelf().inSingletonScope(); + bind(LanguagesMainTestImpl).toSelf().inTransientScope(); + rebind(LanguagesMainFactory).toFactory(context => (rpc: RPCProtocol) => { + const child = context.container.createChild(); + child.bind(RPCProtocol).toConstantValue(rpc); + return child.get(LanguagesMainTestImpl); + }); +}); diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts b/extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts new file mode 100644 index 000000000..f1a76e2d9 --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts @@ -0,0 +1,92 @@ +/********************************************************************* + * Copyright (c) 2020 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import { + CompletionContext, + CompletionResultDto, + SignatureHelp, + Hover, + DocumentHighlight, + Range, + TextEdit, + FormattingOptions, + Definition, + DefinitionLink, + DocumentLink, + CodeLensSymbol, + DocumentSymbol, + ReferenceContext, + Location, + SignatureHelpContext, + CodeActionContext, + CodeAction, + FoldingRange, +} from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; +import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; +import { CancellationToken, FoldingContext } from '@theia/plugin'; +import { SymbolInformation } from 'vscode-languageserver-types'; +import { + Position, + Selection, + RawColorInfo, + WorkspaceEditDto +} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; +import { ProxyIdentifier, createProxyIdentifier } from '@theia/plugin-ext/lib/common/rpc-protocol'; + +// Expose additional API that allows you to know if a language server is connected and build a map of the language servers +export interface TestAPI { + $provideCompletionItems(pluginID: string, resource: UriComponents, position: Position, + context: CompletionContext, token: CancellationToken): Promise; + $provideImplementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + $provideTypeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + $provideDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + $provideDeclaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + $provideReferences(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: CancellationToken): Promise; + $provideSignatureHelp( + pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: CancellationToken + ): Promise; + $provideHover(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + $provideDocumentHighlights(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + $provideDocumentFormattingEdits(pluginID: string, resource: UriComponents, + options: FormattingOptions, token: CancellationToken): Promise; + $provideDocumentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, + options: FormattingOptions, token: CancellationToken): Promise; + $provideOnTypeFormattingEdits( + pluginID: string, + resource: UriComponents, + position: Position, + ch: string, + options: FormattingOptions, + token: CancellationToken + ): Promise; + $provideDocumentLinks(pluginID: string, resource: UriComponents, token: CancellationToken): Promise; + $provideCodeLenses(pluginID: string, resource: UriComponents, token: CancellationToken): Promise; + $provideCodeActions( + pluginID: string, + resource: UriComponents, + rangeOrSelection: Range | Selection, + context: CodeActionContext, + token: CancellationToken + ): Promise; + $provideDocumentSymbols(pluginID: string, resource: UriComponents, token: CancellationToken): Promise; + $provideWorkspaceSymbols(pluginID: string, query: string, token: CancellationToken): PromiseLike; + $provideFoldingRange( + pluginID: string, + resource: UriComponents, + context: FoldingContext, + token: CancellationToken + ): PromiseLike; + $provideDocumentColors(pluginID: string, resource: UriComponents, token: CancellationToken): PromiseLike; + $provideRenameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: CancellationToken): PromiseLike; +} + +export const PLUGIN_RPC_CONTEXT = { + TEST_API_MAIN: >createProxyIdentifier('TestAPI'), +}; diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-api-node-provider.ts b/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-api-node-provider.ts new file mode 100644 index 000000000..270d16ae1 --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-api-node-provider.ts @@ -0,0 +1,67 @@ +/********************************************************************* + * Copyright (c) 2020 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import { Plugin, emptyPlugin } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; +import { ExtPluginApiBackendInitializationFn } from '@theia/plugin-ext'; +import * as testService from '@eclipse-che/testing-service'; +import { PluginManager } from '@theia/plugin-ext'; +import { createAPIFactory, TestApiFactory } from '../plugin/testservice-api'; + +const pluginsApiImpl = new Map(); +let defaultApi: typeof testService; +let isLoadOverride = false; +let TestServiceApiFactory: TestApiFactory; +let plugins: PluginManager; + +export const provideApi: ExtPluginApiBackendInitializationFn = (rpc: RPCProtocol, pluginManager: PluginManager) => { + TestServiceApiFactory = createAPIFactory(rpc); + plugins = pluginManager; + + if (!isLoadOverride) { + overrideInternalLoad(); + isLoadOverride = true; + } + +}; + +function overrideInternalLoad(): void { + const module = require('module'); + // save original load method + const internalLoad = module._load; + + // if we try to resolve @eclipse-che/testing-service module, return the filename entry to use cache. + // tslint:disable-next-line:no-any + module._load = function (request: string, parent: any, isMain: {}): any { + if (request !== '@eclipse-che/testing-service') { + return internalLoad.apply(this, arguments); + } + + const plugin = findPlugin(parent.filename); + if (plugin) { + let apiImpl = pluginsApiImpl.get(plugin.model.id); + if (!apiImpl) { + apiImpl = TestServiceApiFactory(plugin); + pluginsApiImpl.set(plugin.model.id, apiImpl); + } + return apiImpl; + } + + if (!defaultApi) { + defaultApi = TestServiceApiFactory(emptyPlugin); + } + + return defaultApi; + }; +} + +function findPlugin(filePath: string): Plugin | undefined { + return plugins.getAllPlugins().find(plugin => filePath.startsWith(plugin.pluginFolder)); +} diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-ext-backend-module.ts b/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-ext-backend-module.ts new file mode 100644 index 000000000..1287f718d --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-ext-backend-module.ts @@ -0,0 +1,18 @@ +/********************************************************************* + * Copyright (c) 2020 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import { ContainerModule } from 'inversify'; +import { TestServerPluginApiProvider } from '../testservice-plugin-api-provider'; +import { ExtPluginApiProvider } from '@theia/plugin-ext'; + +export default new ContainerModule(bind => { + bind(TestServerPluginApiProvider).toSelf().inSingletonScope(); + bind(Symbol.for(ExtPluginApiProvider)).toService(TestServerPluginApiProvider); +}); diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts b/extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts new file mode 100644 index 000000000..f657d8dc5 --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts @@ -0,0 +1,148 @@ +/********************************************************************* + * Copyright (c) 2020 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import { Plugin } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; +import * as testservice from '@eclipse-che/testing-service'; +import { PLUGIN_RPC_CONTEXT, TestAPI } from '../common/test-protocol'; +import { + CompletionContext, + CompletionResultDto, + SignatureHelp, + Hover, + DocumentHighlight, + Range, + TextEdit, + FormattingOptions, + Definition, + DefinitionLink, + DocumentLink, + CodeLensSymbol, + DocumentSymbol, + ReferenceContext, + Location, + SignatureHelpContext, + CodeActionContext, + CodeAction, + FoldingRange, +} from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; +import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; +import { CancellationToken, FoldingContext } from '@theia/plugin'; +import { SymbolInformation } from 'vscode-languageserver-types'; +import { + Position, + Selection, + RawColorInfo, + WorkspaceEditDto +} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; + +export interface TestApiFactory { + (plugin: Plugin): typeof testservice; +} + +export function createAPIFactory(rpc: RPCProtocol): TestApiFactory { + + return function (plugin: Plugin): typeof testservice { + + const testAPI = rpc.getProxy(PLUGIN_RPC_CONTEXT.TEST_API_MAIN) as TestAPI; + + const languageserver: typeof testservice.languageserver = { + + completion(pluginID: string, resource: UriComponents, position: Position, + context: CompletionContext, token: CancellationToken): Promise { + return testAPI.$provideCompletionItems(pluginID, resource, position, context, token); + }, + implementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + return testAPI.$provideImplementation(pluginID, resource, position, token); + }, + typeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + return testAPI.$provideTypeDefinition(pluginID, resource, position, token); + }, + definition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + return testAPI.$provideDefinition(pluginID, resource, position, token); + }, + declaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + return testAPI.$provideDeclaration(pluginID, resource, position, token); + }, + references(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: CancellationToken): Promise { + return testAPI.$provideReferences(pluginID, resource, position, context, token); + }, + signatureHelp( + pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: CancellationToken + ): Promise { + return testAPI.$provideSignatureHelp(pluginID, resource, position, context, token); + }, + hover(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + return testAPI.$provideHover(pluginID, resource, position, token); + }, + documentHighlights(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + return testAPI.$provideDocumentHighlights(pluginID, resource, position, token); + }, + documentFormattingEdits(pluginID: string, resource: UriComponents, + options: FormattingOptions, token: CancellationToken): Promise { + return testAPI.$provideDocumentFormattingEdits(pluginID, resource, options, token); + }, + documentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, + options: FormattingOptions, token: CancellationToken): Promise { + return testAPI.$provideDocumentRangeFormattingEdits(pluginID, resource, range, options, token); + }, + onTypeFormattingEdits( + pluginID: string, + resource: UriComponents, + position: Position, + ch: string, + options: FormattingOptions, + token: CancellationToken + ): Promise { + return testAPI.$provideOnTypeFormattingEdits(pluginID, resource, position, ch, options, token); + }, + documentLinks(pluginID: string, resource: UriComponents, token: CancellationToken): Promise { + return testAPI.$provideDocumentLinks(pluginID, resource, token); + }, + codeLenses(pluginID: string, resource: UriComponents, token: CancellationToken): Promise { + return testAPI.$provideCodeLenses(pluginID, resource, token); + }, + codeActions( + pluginID: string, + resource: UriComponents, + rangeOrSelection: Range | Selection, + context: CodeActionContext, + token: CancellationToken + ): Promise { + return testAPI.$provideCodeActions(pluginID, resource, rangeOrSelection, context, token); + }, + documentSymbols(pluginID: string, resource: UriComponents, token: CancellationToken): Promise { + return testAPI.$provideDocumentSymbols(pluginID, resource, token); + }, + workspaceSymbols(pluginID: string, query: string, token: CancellationToken): PromiseLike { + return testAPI.$provideWorkspaceSymbols(pluginID, query, token); + }, + foldingRange( + pluginID: string, + resource: UriComponents, + context: FoldingContext, + token: CancellationToken + ): PromiseLike { + return testAPI.$provideFoldingRange(pluginID, resource, context, token); + }, + documentColors(pluginID: string, resource: UriComponents, token: CancellationToken): PromiseLike { + return testAPI.$provideDocumentColors(pluginID, resource, token); + }, + renameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: CancellationToken): PromiseLike { + return testAPI.$provideRenameEdits(pluginID, resource, position, newName, token); + } + }; + + return { + languageserver + }; + + }; +} diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/testservice-plugin-api-provider.ts b/extensions/eclipse-che-theia-testing-service-ext/src/testservice-plugin-api-provider.ts new file mode 100644 index 000000000..a067ad607 --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/src/testservice-plugin-api-provider.ts @@ -0,0 +1,28 @@ +/********************************************************************* + * Copyright (c) 2020 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import { injectable } from 'inversify'; +import { ExtPluginApiProvider, ExtPluginApi } from '@theia/plugin-ext'; +import * as path from 'path'; + +@injectable() +export class TestServerPluginApiProvider implements ExtPluginApiProvider { + + provideApi(): ExtPluginApi { + return { + frontendExtApi: { + initPath: './browser/testservice-api-frontend-provider.js', + initFunction: 'initializeApi', + initVariable: 'testserver_api_provider' + }, + backendInitPath: path.join(__dirname, './node/testservice-api-node-provider.js') + }; + } +} diff --git a/extensions/eclipse-che-theia-testing-service-ext/tsconfig.json b/extensions/eclipse-che-theia-testing-service-ext/tsconfig.json new file mode 100644 index 000000000..e524f781e --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "../../configs/base.tsconfig", + "compilerOptions": { + "lib": [ + "es6", + "dom" + ], + "sourceMap": true, + "rootDir": "src", + "outDir": "lib", + "skipLibCheck": true, + "jsx": "react" + }, + "include": [ + "src/**/*.ts" + ] +} diff --git a/extensions/eclipse-che-theia-testing-service-ext/webpack.config.js b/extensions/eclipse-che-theia-testing-service-ext/webpack.config.js new file mode 100644 index 000000000..ce53911ad --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service-ext/webpack.config.js @@ -0,0 +1,49 @@ +/********************************************************************* + * Copyright (c) 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +const path = require('path'); +const CleanWebpackPlugin = require('clean-webpack-plugin'); + +module.exports = { + entry: './lib/browser/testservice-api-frontend-provider.js', + devtool: 'source-map', + mode: 'production', + node: { + fs: 'empty', + child_process: 'empty', + net: 'empty', + crypto: 'empty' + }, + module: { + rules: [ + { + test: /\.ts$/, + use: [ + { + loader: 'ts-loader', + options: { + transpileOnly: true + } + } + ], + exclude: /node_modules/ + } + ] + }, + resolve: { + extensions: ['.ts', '.js'] + }, + output: { + filename: 'testservice-api-frontend-provider.js', + libraryTarget: "var", + library: "testserver_api_provider", + path: path.resolve(__dirname, 'lib/browser') + } +}; diff --git a/extensions/eclipse-che-theia-testing-service/package.json b/extensions/eclipse-che-theia-testing-service/package.json new file mode 100644 index 000000000..e3b298f74 --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service/package.json @@ -0,0 +1,36 @@ +{ + "name": "@eclipse-che/testing-service", + "version": "0.0.1", + "description": "Theia - Testing Service API", + "types": "./src/testing-service.d.ts", + "publishConfig": { + "access": "public" + }, + "license": "EPL-2.0", + "repository": { + "type": "git", + "url": "https://github.com/eclipse/che-theia.git" + }, + "bugs": { + "url": "https://github.com/eclipse/che/issues" + }, + "homepage": "https://github.com/eclipse/che", + "files": [ + "src", + "lib" + ], + "scripts": { + "prepare": "yarn run clean && yarn run build", + "clean": "rimraf lib", + "format": "tsfmt -r --useTsfmt ../../configs/tsfmt.json", + "lint": "tslint -c ../../configs/tslint.json --project tsconfig.json", + "compile": "tsc", + "build": "concurrently -n \"format,lint,compile\" -c \"red,green,blue\" \"yarn format\" \"yarn lint\" \"yarn compile\"", + "watch": "tsc -w" + }, + "dependencies": { + "@theia/plugin": "next", + "@theia/plugin-ext": "next" + }, + "devDependencies": {} +} diff --git a/extensions/eclipse-che-theia-testing-service/src/testing-service.d.ts b/extensions/eclipse-che-theia-testing-service/src/testing-service.d.ts new file mode 100644 index 000000000..490a43aa9 --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service/src/testing-service.d.ts @@ -0,0 +1,97 @@ +/******************************************************************************** + * Copyright (C) 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + ********************************************************************************/ + +import * as vst from 'vscode-languageserver-types'; +import { + CompletionContext, + CompletionResultDto, + SignatureHelp, + Hover, + DocumentHighlight, + Range, + TextEdit, + FormattingOptions, + Definition, + DefinitionLink, + DocumentLink, + CodeLensSymbol, + DocumentSymbol, + ReferenceContext, + Location, + SignatureHelpContext, + CodeActionContext, + CodeAction, + FoldingRange, +} from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; +import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; +import { CancellationToken, FoldingContext } from '@theia/plugin'; +import { SymbolInformation } from 'vscode-languageserver-types'; +import { + Position, + Selection, + RawColorInfo, + WorkspaceEditDto +} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; + +declare module '@eclipse-che/testing-service' { + + export namespace languageserver { + export function completion(pluginID: string, resource: UriComponents, position: Position, + context: CompletionContext, token: CancellationToken): Promise; + export function implementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + export function typeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + export function definition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + export function declaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + export function references(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: CancellationToken): Promise; + export function signatureHelp( + pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: CancellationToken + ): Promise; + export function hover(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + export function documentHighlights(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + export function documentFormattingEdits(pluginID: string, resource: UriComponents, + options: FormattingOptions, token: CancellationToken): Promise; + export function documentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, + options: FormattingOptions, token: CancellationToken): Promise; + export function onTypeFormattingEdits( + pluginID: string, + resource: UriComponents, + position: Position, + ch: string, + options: FormattingOptions, + token: CancellationToken + ): Promise; + export function documentLinks(pluginID: string, resource: UriComponents, token: CancellationToken): Promise; + export function codeLenses(pluginID: string, resource: UriComponents, token: CancellationToken): Promise; + export function codeActions( + pluginID: string, + resource: UriComponents, + rangeOrSelection: Range | Selection, + context: CodeActionContext, + token: CancellationToken + ): Promise; + export function documentSymbols(pluginID: string, resource: UriComponents, token: CancellationToken): Promise; + export function workspaceSymbols(pluginID: string, query: string, token: CancellationToken): PromiseLike; + export function foldingRange( + pluginID: string, + resource: UriComponents, + context: FoldingContext, + token: CancellationToken + ): PromiseLike; + export function documentColors(pluginID: string, resource: UriComponents, token: CancellationToken): PromiseLike; + export function renameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: CancellationToken): PromiseLike; + } + +} diff --git a/extensions/eclipse-che-theia-testing-service/tsconfig.json b/extensions/eclipse-che-theia-testing-service/tsconfig.json new file mode 100644 index 000000000..a6a832536 --- /dev/null +++ b/extensions/eclipse-che-theia-testing-service/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../configs/base.tsconfig.json", + "compilerOptions": { + "lib": [ + "es6", + "dom" + ], + "rootDir": "src", + "outDir": "lib" + }, + "include": [ + "src" + ] +} diff --git a/yarn.lock b/yarn.lock index 59d9ff22a..aec0369df 100644 --- a/yarn.lock +++ b/yarn.lock @@ -151,11 +151,18 @@ resolved "https://registry.yarnpkg.com/@eclipse-che/api/-/api-7.4.0.tgz#74be0ca037ea2e9702d74971ac2ed8befdcb8a46" integrity sha512-/WDMO6F2lKNuNMAIBmPDYQ22TqGIhrSpK6OaU0aie3qeQa7yxXHtK5nuxyyQGFOZWVdKD9cWisjDyaro7+OM0Q== -"@eclipse-che/api@latest": +"@eclipse-che/api@^7.5.0-SNAPSHOT", "@eclipse-che/api@latest": version "7.5.0-SNAPSHOT" resolved "https://registry.yarnpkg.com/@eclipse-che/api/-/api-7.5.0-SNAPSHOT.tgz#bf0c5be60354e34c73bc52b2e18be8680ce8d900" integrity sha512-4CgKEGCBOIOBGBNoH0dhN8TkP1Sj39fG4LGCXYw3JB7nQucVooJyq7AhIV+w7L4iZ+ln+y2KEfZugCmOIuzIeQ== +"@eclipse-che/plugin@0.0.1-1576925688": + version "0.0.1-1576925688" + resolved "https://registry.yarnpkg.com/@eclipse-che/plugin/-/plugin-0.0.1-1576925688.tgz#067c2f6b6b7a6b8729ba103c3f7fdbd8a4d02e57" + integrity sha512-YEk+DbnZyhVA7ExnKYzbgs7JEeVBf2ofUzF8Ts8U6BGWUrKel2pyzB3lLVWxt5QABBwC/HbHPrnV322UNkk2aQ== + dependencies: + "@eclipse-che/api" latest + "@eclipse-che/plugin@latest": version "0.0.1-1576925688" resolved "https://registry.yarnpkg.com/@eclipse-che/plugin/-/plugin-0.0.1-1576925688.tgz#067c2f6b6b7a6b8729ba103c3f7fdbd8a4d02e57" @@ -1562,6 +1569,17 @@ fuzzy "^0.1.3" minimatch "^3.0.4" +"@theia/navigator@^0.13.0": + version "0.13.0" + resolved "https://registry.yarnpkg.com/@theia/navigator/-/navigator-0.13.0.tgz#fcbcda0598a9db044702612929e6a1aa4b8b07e9" + integrity sha512-qO2690uId/+fO6GAvFiiFbTs0rfDhln0tEVFwzyOO2/w3RYeXRUdVmvOGVzSMvFAMCXGO/nix1b8I0aU0ILw3Q== + dependencies: + "@theia/core" "^0.13.0" + "@theia/filesystem" "^0.13.0" + "@theia/workspace" "^0.13.0" + fuzzy "^0.1.3" + minimatch "^3.0.4" + "@theia/node-pty@0.7.8-theia004": version "0.7.8-theia004" resolved "https://registry.yarnpkg.com/@theia/node-pty/-/node-pty-0.7.8-theia004.tgz#0fe31b958df9315352d5fbeea7075047cf69c935" @@ -1583,6 +1601,13 @@ dependencies: "@theia/core" "0.15.0-next.9a2bc81e" +"@theia/output@^0.13.0": + version "0.13.0" + resolved "https://registry.yarnpkg.com/@theia/output/-/output-0.13.0.tgz#5c44a5edac042e12ec6c18c1b138b7d1109e6511" + integrity sha512-4ndQG4s5BrN8WgaPyM7EuFIdZ9vVSR1dMs3+E5q2DIlNNVHnixvKvJkT5qcJa1g5iNPvsKLi/73ZYp+or5WENg== + dependencies: + "@theia/core" "^0.13.0" + "@theia/plugin-dev@next": version "0.15.0-next.9a2bc81e" resolved "https://registry.yarnpkg.com/@theia/plugin-dev/-/plugin-dev-0.15.0-next.9a2bc81e.tgz#39d4ca63e4d55b4346181a7abfa7953928a275c4" @@ -1655,6 +1680,47 @@ vscode-debugprotocol "^1.32.0" vscode-textmate "^4.0.1" +"@theia/plugin-ext@^0.13.0": + version "0.13.0" + resolved "https://registry.yarnpkg.com/@theia/plugin-ext/-/plugin-ext-0.13.0.tgz#4538e164edc405162c4c884259b19ad42e6fcd7e" + integrity sha512-To7XZgXXu063bL+k9ORrbfQcmKpyXZ9HTOtMtiGfgLyoMByNoNIrXx+I/qzpgze/yuixHiPpg+VtcpA/C6hsig== + dependencies: + "@theia/core" "^0.13.0" + "@theia/debug" "^0.13.0" + "@theia/editor" "^0.13.0" + "@theia/file-search" "^0.13.0" + "@theia/filesystem" "^0.13.0" + "@theia/languages" "^0.13.0" + "@theia/markers" "^0.13.0" + "@theia/messages" "^0.13.0" + "@theia/monaco" "^0.13.0" + "@theia/navigator" "^0.13.0" + "@theia/output" "^0.13.0" + "@theia/plugin" "^0.13.0" + "@theia/preferences" "^0.13.0" + "@theia/scm" "^0.13.0" + "@theia/search-in-workspace" "^0.13.0" + "@theia/task" "^0.13.0" + "@theia/terminal" "^0.13.0" + "@theia/workspace" "^0.13.0" + "@types/connect" "^3.4.32" + "@types/mime" "^2.0.1" + "@types/serve-static" "^1.13.3" + connect "^3.7.0" + decompress "^4.2.0" + escape-html "^1.0.3" + jsonc-parser "^2.0.2" + lodash.clonedeep "^4.5.0" + macaddress "^0.2.9" + mime "^2.4.4" + ps-tree "^1.2.0" + request "^2.82.0" + serve-static "^1.14.1" + uuid "^3.2.1" + vhost "^3.0.2" + vscode-debugprotocol "^1.32.0" + vscode-textmate "^4.0.1" + "@theia/plugin-packager@latest": version "0.0.1-1551941037" resolved "https://registry.yarnpkg.com/@theia/plugin-packager/-/plugin-packager-0.0.1-1551941037.tgz#859d408be29c6c910f3156ee3ad7c0eb8bfe0ab4" @@ -1784,6 +1850,19 @@ moment "^2.21.0" valid-filename "^2.0.1" +"@theia/workspace@^0.13.0": + version "0.13.0" + resolved "https://registry.yarnpkg.com/@theia/workspace/-/workspace-0.13.0.tgz#a3902bbd690ae5108fa28bf7fb42c26111a9e40b" + integrity sha512-M2SHTz9LXINw88FzGL6Y5Yb8Zfx5qWM5WKbPhacf382qbWvdn6O4LrfNZUm+JjvpfCi4XQ4UVpD0fq3AJe2Snw== + dependencies: + "@theia/core" "^0.13.0" + "@theia/filesystem" "^0.13.0" + "@theia/variable-resolver" "^0.13.0" + ajv "^6.5.3" + jsonc-parser "^2.0.2" + moment "^2.21.0" + valid-filename "^2.0.1" + "@typefox/monaco-editor-core@^0.18.0-next": version "0.18.0-next.1" resolved "https://registry.yarnpkg.com/@typefox/monaco-editor-core/-/monaco-editor-core-0.18.0-next.1.tgz#c31d3361215703b524065f460e1b4b6b714699db" @@ -1949,6 +2028,11 @@ resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.11.2.tgz#699ad86054cc20043c30d66a6fcde30bbf5d3d5e" integrity sha512-JRDtMPEqXrzfuYAdqbxLot1GvAr/QvicIZAnOAigZaj8xVMhuSJTg/xsv9E1TvyL+wujYhRLx9ZsQ0oFOSmwyA== +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= + "@types/lodash.debounce@4.0.3": version "4.0.3" resolved "https://registry.yarnpkg.com/@types/lodash.debounce/-/lodash.debounce-4.0.3.tgz#d712aee9e6136be77f70523ed9f0fc049a6cf15a" @@ -1983,6 +2067,11 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== +"@types/mocha@2.2.43": + version "2.2.43" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.43.tgz#03c54589c43ad048cbcbfd63999b55d0424eec27" + integrity sha512-xNlAmH+lRJdUMXClMTI9Y0pRqIojdxfm7DHsIxoB2iTzu3fnPmSMEN8SsSx0cdwV36d02PWCWaDUoZPDSln+xw== + "@types/mustache@0.8.32": version "0.8.32" resolved "https://registry.yarnpkg.com/@types/mustache/-/mustache-0.8.32.tgz#7db3b81f2bf450bd38805f596d20eca97c4ed595" @@ -2008,6 +2097,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.14.tgz#b6c60ebf2fb5e4229fdd751ff9ddfae0f5f31541" integrity sha512-G0UmX5uKEmW+ZAhmZ6PLTQ5eu/VPaT+d/tdLd5IFsKRPcbe6lPxocBtcYBFSaLaCW8O60AX90e91Nsp8lVHCNw== +"@types/node@^12.11.7": + version "12.12.22" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.22.tgz#b8d9eae3328b96910a373cf06ac8d3c5abe9c200" + integrity sha512-r5i93jqbPWGXYXxianGATOxTelkp6ih/U0WVnvaqAvTqM+0U6J3kw6Xk6uq/dWNRkEVw/0SLcO5ORXbVNz4FMQ== + "@types/normalize-package-data@*": version "2.4.0" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" @@ -2153,6 +2247,11 @@ resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-3.4.7.tgz#51d42247473bc00e38cc8dfaf70d936842a36c03" integrity sha512-C2j2FWgQkF1ru12SjZJyMaTPxs/f6n90+5G5qNakBxKXjTBc/YTSelHh4Pz1HUDwxFXD9WvpQhOGCDC+/Y4mIQ== +"@types/vscode@^1.41.0": + version "1.41.0" + resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.41.0.tgz#b0d75920220f84e07093285e59180c0f11d336cd" + integrity sha512-7SfeY5u9jgiELwxyLB3z7l6l/GbN9CqpCQGkcRlB7tKRFBxzbz2PoBfGrLxI1vRfUCIq5+hg5vtDHExwq5j3+A== + "@types/webpack-sources@*": version "0.1.6" resolved "https://registry.yarnpkg.com/@types/webpack-sources/-/webpack-sources-0.1.6.tgz#3d21dfc2ec0ad0c77758e79362426a9ba7d7cbcb" @@ -2484,6 +2583,11 @@ anser@^1.4.7: resolved "https://registry.yarnpkg.com/anser/-/anser-1.4.9.tgz#1f85423a5dcf8da4631a341665ff675b96845760" integrity sha512-AI+BjTeGt2+WFk4eWcqbQ7snZpDBt8SaLlj0RT2h5xfdWaiy51OjYvqwMrNzJLGy8iOAL6nKDITWO+rd4MkYEA== +ansi-colors@3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813" + integrity sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw== + ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" @@ -2608,6 +2712,11 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +arg@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.2.tgz#e70c90579e02c63d80e3ad4e31d8bfdb8bd50064" + integrity sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -2684,7 +2793,7 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= -arrify@^1.0.1: +arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= @@ -3216,6 +3325,16 @@ browser-resolve@^1.11.2, browser-resolve@^1.11.3: dependencies: resolve "1.1.7" +browser-stdout@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" + integrity sha1-81HTKWnTL6XXpVZxVCY9korjvR8= + +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + browserify-aes@^1.0.0, browserify-aes@^1.0.4: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" @@ -3317,7 +3436,7 @@ buffer-fill@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" integrity sha1-+PeLdniYiO858gXNY39o5wISKyw= -buffer-from@1.x, buffer-from@^1.0.0: +buffer-from@1.x, buffer-from@^1.0.0, buffer-from@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== @@ -3599,6 +3718,11 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== +charenc@~0.0.1: + version "0.0.2" + resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" + integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc= + chokidar@^1.6.0, chokidar@^1.6.1: version "1.7.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" @@ -3809,6 +3933,13 @@ commander@2.6.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.6.0.tgz#9df7e52fb2a0cb0fb89058ee80c3104225f37e1d" integrity sha1-nfflL7Kgyw+4kFjugMMQQiXzfh0= +commander@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" + integrity sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q= + dependencies: + graceful-readlink ">= 1.0.0" + commander@^2.12.1, commander@^2.19.0, commander@^2.20.0, commander@~2.20.3: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -4187,6 +4318,11 @@ cross-spawn@^5.0.1: shebang-command "^1.2.0" which "^1.2.9" +crypt@~0.0.1: + version "0.0.2" + resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" + integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs= + crypto-browserify@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" @@ -4281,6 +4417,13 @@ dateformat@^3.0.0: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== +debug@2.6.8: + version "2.6.8" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" + integrity sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw= + dependencies: + ms "2.0.0" + debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -4545,6 +4688,11 @@ diff@^3.2.0, diff@^3.4.0: resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== +diff@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" + integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== + diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -4861,7 +5009,7 @@ escape-string-applescript@^2.0.0: resolved "https://registry.yarnpkg.com/escape-string-applescript/-/escape-string-applescript-2.0.0.tgz#760bca838668e408fe5ee52ce42caf7cb46c5273" integrity sha1-dgvKg4Zo5Aj+XuUs5CyvfLRsUnM= -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= @@ -5379,6 +5527,13 @@ find-index@^0.1.1: resolved "https://registry.yarnpkg.com/find-index/-/find-index-0.1.1.tgz#675d358b2ca3892d795a1ab47232f8b6e2e0dde4" integrity sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ= +find-up@3.0.0, find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -5394,13 +5549,6 @@ find-up@^2.0.0, find-up@^2.1.0: dependencies: locate-path "^2.0.0" -find-up@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" - integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== - dependencies: - locate-path "^3.0.0" - findup-sync@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-3.0.0.tgz#17b108f9ee512dfb7a5c7f3c8b27ea9e1a9c08d1" @@ -5411,6 +5559,13 @@ findup-sync@3.0.0: micromatch "^3.0.4" resolve-dir "^1.0.1" +flat@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/flat/-/flat-4.1.0.tgz#090bec8b05e39cba309747f1d588f04dbaf98db2" + integrity sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw== + dependencies: + is-buffer "~2.0.3" + fliplog@^0.3.13: version "0.3.13" resolved "https://registry.yarnpkg.com/fliplog/-/fliplog-0.3.13.tgz#dd0d786e821822aae272e0ddc84012596a96154c" @@ -5850,6 +6005,18 @@ glob2base@^0.0.12: dependencies: find-index "^0.1.1" +glob@7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" + integrity sha1-gFIR3wT6rxxjo2ADBs31reULLsg= + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" @@ -5873,7 +6040,7 @@ glob@^6.0.1: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: +glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -6021,6 +6188,16 @@ graceful-fs@^4.1.0, graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.1 resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" integrity sha1-TK+tdrxi8C+gObL5Tpo906ORpyU= +growl@1.10.5: + version "1.10.5" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== + +growl@1.9.2: + version "1.9.2" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" + integrity sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8= + growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" @@ -6143,7 +6320,12 @@ hash.js@^1.0.0, hash.js@^1.0.3: inherits "^2.0.3" minimalistic-assert "^1.0.1" -he@1.2.x: +he@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" + integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0= + +he@1.2.0, he@1.2.x: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== @@ -6286,7 +6468,7 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= -https-proxy-agent@^2.2.3: +https-proxy-agent@^2.2.3, https-proxy-agent@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b" integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg== @@ -6550,12 +6732,12 @@ is-binary-path@^1.0.0: dependencies: binary-extensions "^1.0.0" -is-buffer@^1.1.5: +is-buffer@^1.1.5, is-buffer@~1.1.1: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== -is-buffer@^2.0.2: +is-buffer@^2.0.2, is-buffer@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.4.tgz#3e572f23c8411a5cfd9557c849e3665e0b290623" integrity sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A== @@ -8333,6 +8515,34 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" +lodash._baseassign@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" + integrity sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4= + dependencies: + lodash._basecopy "^3.0.0" + lodash.keys "^3.0.0" + +lodash._basecopy@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" + integrity sha1-jaDmqHbPNEwK2KVIghEd08XHyjY= + +lodash._basecreate@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" + integrity sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE= + +lodash._getnative@^3.0.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" + integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U= + +lodash._isiterateecall@^3.0.0: + version "3.0.9" + resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" + integrity sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw= + lodash._reinterpolate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" @@ -8343,6 +8553,15 @@ lodash.clonedeep@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= +lodash.create@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" + integrity sha1-1/KEnw29p+BGgruM1yqwIkYd6+c= + dependencies: + lodash._baseassign "^3.0.0" + lodash._basecreate "^3.0.0" + lodash._isiterateecall "^3.0.0" + lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" @@ -8353,6 +8572,16 @@ lodash.get@^4.4.2: resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= +lodash.isarguments@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + integrity sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo= + +lodash.isarray@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" + integrity sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U= + lodash.isinteger@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz#619c0af3d03f8b04c31f5882840b77b11cd68343" @@ -8413,7 +8642,7 @@ lodash@^4.17.10, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17 resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== -log-symbols@^2.1.0: +log-symbols@2.2.0, log-symbols@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" integrity sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg== @@ -8490,7 +8719,7 @@ make-dir@^2.0.0, make-dir@^2.1.0: pify "^4.0.1" semver "^5.6.0" -make-error@1.x: +make-error@1.x, make-error@^1.1.1: version "1.3.5" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== @@ -8583,6 +8812,15 @@ md5.js@^1.3.4: inherits "^2.0.1" safe-buffer "^5.1.2" +md5@^2.1.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/md5/-/md5-2.2.1.tgz#53ab38d5fe3c8891ba465329ea23fac0540126f9" + integrity sha1-U6s41f48iJG6RlMp6iP6wFQBJvk= + dependencies: + charenc "~0.0.1" + crypt "~0.0.1" + is-buffer "~1.1.1" + mdurl@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" @@ -8796,7 +9034,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -"minimatch@2 || 3", minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: +"minimatch@2 || 3", minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -8872,13 +9110,79 @@ mkdirp-promise@^5.0.1: dependencies: mkdirp "*" -mkdirp@*, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: +mkdirp@*, mkdirp@0.5.1, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= dependencies: minimist "0.0.8" +mocha-junit-reporter@^1.17.0: + version "1.23.1" + resolved "https://registry.yarnpkg.com/mocha-junit-reporter/-/mocha-junit-reporter-1.23.1.tgz#ba11519c0b967f404e4123dd69bc4ba022ab0f12" + integrity sha512-qeDvKlZyAH2YJE1vhryvjUQ06t2hcnwwu4k5Ddwn0GQINhgEYFhlGM0DwYCVUHq5cuo32qAW6HDsTHt7zz99Ng== + dependencies: + debug "^2.2.0" + md5 "^2.1.0" + mkdirp "~0.5.1" + strip-ansi "^4.0.0" + xml "^1.0.0" + +mocha-multi-reporters@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/mocha-multi-reporters/-/mocha-multi-reporters-1.1.7.tgz#cc7f3f4d32f478520941d852abb64d9988587d82" + integrity sha1-zH8/TTL0eFIJQdhSq7ZNmYhYfYI= + dependencies: + debug "^3.1.0" + lodash "^4.16.4" + +mocha@^3.4.2: + version "3.5.3" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.5.3.tgz#1e0480fe36d2da5858d1eb6acc38418b26eaa20d" + integrity sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg== + dependencies: + browser-stdout "1.3.0" + commander "2.9.0" + debug "2.6.8" + diff "3.2.0" + escape-string-regexp "1.0.5" + glob "7.1.1" + growl "1.9.2" + he "1.1.1" + json3 "3.3.2" + lodash.create "3.1.1" + mkdirp "0.5.1" + supports-color "3.1.2" + +mocha@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.2.2.tgz#5d8987e28940caf8957a7d7664b910dc5b2fea20" + integrity sha512-FgDS9Re79yU1xz5d+C4rv1G7QagNGHZ+iXF81hO8zY35YZZcLEsJVfFolfsqKFWunATEvNzMK0r/CwWd/szO9A== + dependencies: + ansi-colors "3.2.3" + browser-stdout "1.3.1" + debug "3.2.6" + diff "3.5.0" + escape-string-regexp "1.0.5" + find-up "3.0.0" + glob "7.1.3" + growl "1.10.5" + he "1.2.0" + js-yaml "3.13.1" + log-symbols "2.2.0" + minimatch "3.0.4" + mkdirp "0.5.1" + ms "2.1.1" + node-environment-flags "1.0.5" + object.assign "4.1.0" + strip-json-comments "2.0.1" + supports-color "6.0.0" + which "1.3.1" + wide-align "1.1.3" + yargs "13.3.0" + yargs-parser "13.1.1" + yargs-unparser "1.6.0" + mock-require@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/mock-require/-/mock-require-2.0.2.tgz#1eaa71aad23013773d127dc7e91a3fbb4837d60d" @@ -9107,6 +9411,14 @@ node-abi@^2.2.0: dependencies: semver "^5.4.1" +node-environment-flags@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.5.tgz#fa930275f5bf5dae188d6192b24b4c8bbac3d76a" + integrity sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ== + dependencies: + object.getownpropertydescriptors "^2.0.3" + semver "^5.7.0" + node-fetch-npm@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/node-fetch-npm/-/node-fetch-npm-2.0.2.tgz#7258c9046182dca345b4208eda918daf33697ff7" @@ -11555,7 +11867,7 @@ strip-indent@^2.0.0: resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" integrity sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g= -strip-json-comments@~2.0.1: +strip-json-comments@2.0.1, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= @@ -11969,6 +12281,50 @@ ts-md5@^1.2.2: resolved "https://registry.yarnpkg.com/ts-md5/-/ts-md5-1.2.7.tgz#b76471fc2fd38f0502441f6c3b9494ed04537401" integrity sha512-emODogvKGWi1KO1l9c6YxLMBn6CEH3VrH5mVPIyOtxBG52BvV4jP3GWz6bOZCz61nLgBc3ffQYE4+EHfCD+V7w== +ts-mocha@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/ts-mocha/-/ts-mocha-6.0.0.tgz#40b8c5462ffce6f5dcee5ff729655b2958f26e50" + integrity sha512-ZCtJK8WXxHNbFNjvUKQIXZby/+ybQQkaBcM/3QhBQUfwjpdGFE9F6iWsHhF5ifQNFV/lWiOODi2VMD5AyPcQyg== + dependencies: + ts-node "7.0.1" + optionalDependencies: + tsconfig-paths "^3.5.0" + +ts-node@7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-7.0.1.tgz#9562dc2d1e6d248d24bc55f773e3f614337d9baf" + integrity sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw== + dependencies: + arrify "^1.0.0" + buffer-from "^1.1.0" + diff "^3.1.0" + make-error "^1.1.1" + minimist "^1.2.0" + mkdirp "^0.5.1" + source-map-support "^0.5.6" + yn "^2.0.0" + +ts-node@^8.5.2: + version "8.5.4" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.5.4.tgz#a152add11fa19c221d0b48962c210cf467262ab2" + integrity sha512-izbVCRV68EasEPQ8MSIGBNK9dc/4sYJJKYA+IarMQct1RtEot6Xp0bXuClsbUSnKpg50ho+aOAx8en5c+y4OFw== + dependencies: + arg "^4.1.0" + diff "^4.0.1" + make-error "^1.1.1" + source-map-support "^0.5.6" + yn "^3.0.0" + +tsconfig-paths@^3.5.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" + integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.1" + minimist "^1.2.0" + strip-bom "^3.0.0" + tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" @@ -12096,6 +12452,11 @@ typescript@3.5.3, typescript@~3.5.3: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== +typescript@^2.0.x: + version "2.9.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c" + integrity sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w== + uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" @@ -12453,6 +12814,15 @@ vscode-ripgrep@^1.2.4: resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.5.7.tgz#acb6b548af488a4bca5d0f1bb5faf761343289ce" integrity sha512-/Vsz/+k8kTvui0q3O74pif9FK0nKopgFTiGNVvxicZANxtSA8J8gUE9GQ/4dpi7D/2yI/YVORszwVskFbz46hQ== +vscode-test@^1.2.3: + version "1.3.0" + resolved "https://registry.yarnpkg.com/vscode-test/-/vscode-test-1.3.0.tgz#3310ab385d9b887b4c82e8f52be1030e7cf9493d" + integrity sha512-LddukcBiSU2FVTDr3c1D8lwkiOvwlJdDL2hqVbn6gIz+rpTqUCkMZSKYm94Y1v0WXlHSDQBsXyY+tchWQgGVsw== + dependencies: + http-proxy-agent "^2.1.0" + https-proxy-agent "^2.2.4" + rimraf "^2.6.3" + vscode-textmate@^4.0.1: version "4.4.0" resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-4.4.0.tgz#14032afeb50152e8f53258c95643e555f2948305" @@ -12644,7 +13014,7 @@ which@^1.2.12, which@^1.2.14, which@^1.2.8, which@^1.2.9, which@^1.3.0, which@^1 dependencies: isexe "^2.0.0" -wide-align@^1.1.0: +wide-align@1.1.3, wide-align@^1.1.0: version "1.1.3" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== @@ -12790,6 +13160,11 @@ xml-name-validator@^3.0.0: resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== +xml@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" + integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU= + xregexp@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.0.0.tgz#e698189de49dd2a18cc5687b05e17c8e43943020" @@ -12842,10 +13217,10 @@ yargs-parser@10.x, yargs-parser@^10.0.0, yargs-parser@^10.1.0: dependencies: camelcase "^4.1.0" -yargs-parser@^11.1.1: - version "11.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4" - integrity sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ== +yargs-parser@13.1.1, yargs-parser@^13.1.0, yargs-parser@^13.1.1: + version "13.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" + integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ== dependencies: camelcase "^5.0.0" decamelize "^1.2.0" @@ -12880,6 +13255,15 @@ yargs-parser@^9.0.2: dependencies: camelcase "^4.1.0" +yargs-unparser@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-1.6.0.tgz#ef25c2c769ff6bd09e4b0f9d7c605fb27846ea9f" + integrity sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw== + dependencies: + flat "^4.1.0" + lodash "^4.17.15" + yargs "^13.3.0" + yargs@12.0.1: version "12.0.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.1.tgz#6432e56123bb4e7c3562115401e98374060261c2" @@ -12933,6 +13317,22 @@ yargs@13.2.4: y18n "^4.0.0" yargs-parser "^13.1.0" +yargs@13.3.0, yargs@^13.3.0: + version "13.3.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" + integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.1" + yargs@^10.0.3: version "10.1.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-10.1.2.tgz#454d074c2b16a51a43e2fb7807e4f9de69ccb5c5" @@ -13010,6 +13410,16 @@ yauzl@^2.4.2: buffer-crc32 "~0.2.3" fd-slicer "~1.1.0" +yn@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a" + integrity sha1-5a2ryKz0CPY4X8dklWhMiOavaJo= + +yn@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + zip-dir@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/zip-dir/-/zip-dir-1.0.2.tgz#253f907aead62a21acd8721d8b88032b2411c051" From 55289847b7608871c79e2963a4c513f9ee61f993 Mon Sep 17 00:00:00 2001 From: svor Date: Fri, 10 Jul 2020 20:40:48 +0300 Subject: [PATCH 02/12] Fix build errors Signed-off-by: svor --- .../package.json | 6 +++--- .../src/browser/languages-test-api.ts | 9 ++++----- .../src/browser/languages-test-main.ts | 7 ++++++- .../browser/testservice-api-frontend-provider.ts | 6 +++--- .../src/common/test-protocol.ts | 13 ++++++------- .../src/node/testservice-api-node-provider.ts | 2 +- .../src/plugin/testservice-api.ts | 13 ++++++------- .../eclipse-che-theia-testing-service/package.json | 2 +- 8 files changed, 30 insertions(+), 28 deletions(-) diff --git a/extensions/eclipse-che-theia-testing-service-ext/package.json b/extensions/eclipse-che-theia-testing-service-ext/package.json index 76d3a1ead..3f0f43cc5 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/package.json +++ b/extensions/eclipse-che-theia-testing-service-ext/package.json @@ -3,8 +3,8 @@ "version": "0.0.1", "description": "Theia - TestService Extension", "dependencies": { - "@theia/plugin": "^0.15.0", - "@theia/plugin-ext": "^0.15.0", + "@theia/plugin": "next", + "@theia/plugin-ext": "next", "@eclipse-che/testing-service": "^0.0.1", "glob": "^7.1.6", "mocha": "^3.4.2" @@ -30,7 +30,7 @@ "prepare": "yarn clean && yarn build", "clean": "rimraf lib", "format": "tsfmt -r --useTsfmt ../../configs/tsfmt.json", - "lint": "tslint -c ../../configs/tslint.json --project tsconfig.json", + "lint": "eslint --cache=true --no-error-on-unmatched-pattern=true \"{src,test}/**/*.{ts,tsx}\"", "compile": "tsc", "build": "concurrently -n \"format,lint,compile\" -c \"red,green,blue\" \"yarn format\" \"yarn lint\" \"yarn compile\" && yarn run compileWorker", "compileWorker": "webpack-cli --config webpack.config.js", diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts index 8c593e32a..48f5b1a92 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts +++ b/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts @@ -21,7 +21,6 @@ import { TextEdit, FormattingOptions, Definition, - DefinitionLink, DocumentLink, CodeLensSymbol, DocumentSymbol, @@ -59,12 +58,12 @@ export class TestAPIImpl implements TestAPI { return languagesExt.$provideCompletionItems(handle, resource, position, context, token); } - async $provideDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + async $provideDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'definition'); return languagesExt.$provideDefinition(handle, resource, position, token); } - async $provideDeclaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + async $provideDeclaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'declaration'); return languagesExt.$provideDeclaration(handle, resource, position, token); } @@ -75,12 +74,12 @@ export class TestAPIImpl implements TestAPI { return languagesExt.$provideSignatureHelp(handle, resource, position, context, token); } - async $provideImplementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + async $provideImplementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'implementation'); return languagesExt.$provideImplementation(handle, resource, position, token); } - async $provideTypeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + async $provideTypeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'typeDefinition'); return languagesExt.$provideTypeDefinition(handle, resource, position, token); } diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts index 9abadfd74..c2e893604 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts +++ b/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts @@ -81,7 +81,7 @@ export class LanguagesMainTestImpl implements LanguagesMain { this.languagesMainImpl.$changeDiagnostics(id, delta); } - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any $emitCodeLensEvent(eventHandle: number, event?: any): void { this.languagesMainImpl.$emitCodeLensEvent(eventHandle, event); } @@ -92,6 +92,11 @@ export class LanguagesMainTestImpl implements LanguagesMain { this.languagesMainImpl.$registerCompletionSupport(handle, pluginInfo, selector, triggerCharacters, supportsResolveDetails); } + $registerSelectionRangeProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { + this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'selectionRange', this.languagesExtProxy); + this.languagesMainImpl.$registerSelectionRangeProvider(handle, pluginInfo, selector); + } + $registerDefinitionProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void { this.pluginHandleRegistry.registerPluginWithFeatureHandle(handle, pluginInfo.id, 'definition', this.languagesExtProxy); this.languagesMainImpl.$registerDefinitionProvider(handle, pluginInfo, selector); diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-api-frontend-provider.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-api-frontend-provider.ts index 53bc1f33c..765ce0cfd 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-api-frontend-provider.ts +++ b/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-api-frontend-provider.ts @@ -14,7 +14,7 @@ import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; import * as testService from '@eclipse-che/testing-service'; import { createAPIFactory } from '../plugin/testservice-api'; -// tslint:disable-next-line:no-any +// eslint-disable-next-line @typescript-eslint/no-explicit-any const ctx = self as any; const pluginsApiImpl = new Map(); let defaultApi: typeof testService; @@ -22,7 +22,7 @@ let defaultApi: typeof testService; export const initializeApi: ExtPluginApiFrontendInitializationFn = (rpc: RPCProtocol, plugins: Map) => { const TestServiceApiFactory = createAPIFactory(rpc); const handler = { - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any get: (target: any, name: string) => { const plugin = plugins.get(name); if (plugin) { @@ -42,6 +42,6 @@ export const initializeApi: ExtPluginApiFrontendInitializationFn = (rpc: RPCProt } }; - // tslint:disable-next-line:no-null-keyword + // eslint-disable-next-line no-null/no-null ctx['test'] = new Proxy(Object.create(null), handler); }; diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts b/extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts index f1a76e2d9..0c05aba1f 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts +++ b/extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts @@ -18,7 +18,6 @@ import { TextEdit, FormattingOptions, Definition, - DefinitionLink, DocumentLink, CodeLensSymbol, DocumentSymbol, @@ -38,16 +37,16 @@ import { RawColorInfo, WorkspaceEditDto } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; -import { ProxyIdentifier, createProxyIdentifier } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import { createProxyIdentifier } from '@theia/plugin-ext/lib/common/rpc-protocol'; // Expose additional API that allows you to know if a language server is connected and build a map of the language servers export interface TestAPI { $provideCompletionItems(pluginID: string, resource: UriComponents, position: Position, context: CompletionContext, token: CancellationToken): Promise; - $provideImplementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - $provideTypeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - $provideDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - $provideDeclaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + $provideImplementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + $provideTypeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + $provideDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; + $provideDeclaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; $provideReferences(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: CancellationToken): Promise; $provideSignatureHelp( pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: CancellationToken @@ -88,5 +87,5 @@ export interface TestAPI { } export const PLUGIN_RPC_CONTEXT = { - TEST_API_MAIN: >createProxyIdentifier('TestAPI'), + TEST_API_MAIN: createProxyIdentifier('TestAPI'), }; diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-api-node-provider.ts b/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-api-node-provider.ts index 270d16ae1..5ae04efc1 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-api-node-provider.ts +++ b/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-api-node-provider.ts @@ -38,7 +38,7 @@ function overrideInternalLoad(): void { const internalLoad = module._load; // if we try to resolve @eclipse-che/testing-service module, return the filename entry to use cache. - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any module._load = function (request: string, parent: any, isMain: {}): any { if (request !== '@eclipse-che/testing-service') { return internalLoad.apply(this, arguments); diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts b/extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts index f657d8dc5..c11923f38 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts +++ b/extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts @@ -11,7 +11,7 @@ import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; import { Plugin } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; import * as testservice from '@eclipse-che/testing-service'; -import { PLUGIN_RPC_CONTEXT, TestAPI } from '../common/test-protocol'; +import { PLUGIN_RPC_CONTEXT } from '../common/test-protocol'; import { CompletionContext, CompletionResultDto, @@ -22,7 +22,6 @@ import { TextEdit, FormattingOptions, Definition, - DefinitionLink, DocumentLink, CodeLensSymbol, DocumentSymbol, @@ -51,7 +50,7 @@ export function createAPIFactory(rpc: RPCProtocol): TestApiFactory { return function (plugin: Plugin): typeof testservice { - const testAPI = rpc.getProxy(PLUGIN_RPC_CONTEXT.TEST_API_MAIN) as TestAPI; + const testAPI = rpc.getProxy(PLUGIN_RPC_CONTEXT.TEST_API_MAIN); const languageserver: typeof testservice.languageserver = { @@ -59,16 +58,16 @@ export function createAPIFactory(rpc: RPCProtocol): TestApiFactory { context: CompletionContext, token: CancellationToken): Promise { return testAPI.$provideCompletionItems(pluginID, resource, position, context, token); }, - implementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + implementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { return testAPI.$provideImplementation(pluginID, resource, position, token); }, - typeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + typeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { return testAPI.$provideTypeDefinition(pluginID, resource, position, token); }, - definition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + definition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { return testAPI.$provideDefinition(pluginID, resource, position, token); }, - declaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + declaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { return testAPI.$provideDeclaration(pluginID, resource, position, token); }, references(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: CancellationToken): Promise { diff --git a/extensions/eclipse-che-theia-testing-service/package.json b/extensions/eclipse-che-theia-testing-service/package.json index e3b298f74..3b7db95ac 100644 --- a/extensions/eclipse-che-theia-testing-service/package.json +++ b/extensions/eclipse-che-theia-testing-service/package.json @@ -23,7 +23,7 @@ "prepare": "yarn run clean && yarn run build", "clean": "rimraf lib", "format": "tsfmt -r --useTsfmt ../../configs/tsfmt.json", - "lint": "tslint -c ../../configs/tslint.json --project tsconfig.json", + "lint": "eslint --cache=true --no-error-on-unmatched-pattern=true \"{src,test}/**/*.{ts,tsx}\"", "compile": "tsc", "build": "concurrently -n \"format,lint,compile\" -c \"red,green,blue\" \"yarn format\" \"yarn lint\" \"yarn compile\"", "watch": "tsc -w" From f2f47f6b6c609d1f24f9ef966f2fc45ba5214686 Mon Sep 17 00:00:00 2001 From: svor Date: Fri, 10 Jul 2020 20:43:05 +0300 Subject: [PATCH 03/12] Add empty line Signed-off-by: svor --- extensions/eclipse-che-theia-testing-service-ext/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/eclipse-che-theia-testing-service-ext/package.json b/extensions/eclipse-che-theia-testing-service-ext/package.json index 3f0f43cc5..d355cb3f7 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/package.json +++ b/extensions/eclipse-che-theia-testing-service-ext/package.json @@ -44,4 +44,4 @@ "typescript-formatter": "7.2.2", "@types/js-yaml": "3.11.2" } -} \ No newline at end of file +} From 7d4b45ca198f9e2616eb8c2ea5ecccfc91273b3e Mon Sep 17 00:00:00 2001 From: svor Date: Fri, 10 Jul 2020 20:46:13 +0300 Subject: [PATCH 04/12] Add selectionRange language action Signed-off-by: svor --- .../src/browser/languages-test-main.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts index c2e893604..93e692ada 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts +++ b/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts @@ -40,6 +40,7 @@ export type LanguageServerActions = 'symbols' | 'documentColors' | 'foldingRange' | + 'selectionRange' | 'renameEdits'; @injectable() From 9e4a4b22b10c9de34123953766286ec0758bb9d4 Mon Sep 17 00:00:00 2001 From: svor Date: Wed, 12 Aug 2020 11:21:51 +0300 Subject: [PATCH 05/12] Move language test API under che namespace Signed-off-by: svor --- che-theia-init-sources.yml | 2 - .../src/browser/che-api-provider.ts | 2 + .../src/browser/che-frontend-module.ts | 13 ++ .../src/browser/che-languages-test-api.ts} | 12 +- .../src/browser/che-languages-test-main.ts} | 8 +- .../browser/che-plugin-handle-registry.ts} | 6 +- .../common/che-languages-test-protocol.ts} | 7 +- .../src/common/che-protocol.ts | 3 + .../src/plugin/che-api.ts | 125 ++++++++++++++- .../src/che-proposed.d.ts | 76 +++++++++ .../.gitignore | 1 - .../package.json | 47 ------ .../src/browser/test-api-provider.ts | 24 --- .../testservice-api-frontend-provider.ts | 47 ------ .../testservice-ext-frontend-module.ts | 29 ---- .../src/node/testservice-api-node-provider.ts | 67 -------- .../node/testservice-ext-backend-module.ts | 18 --- .../src/plugin/testservice-api.ts | 147 ------------------ .../src/testservice-plugin-api-provider.ts | 28 ---- .../tsconfig.json | 17 -- .../webpack.config.js | 49 ------ .../package.json | 36 ----- .../src/testing-service.d.ts | 97 ------------ .../tsconfig.json | 14 -- .../src/browser/che-workspace-controller.ts | 2 +- .../configs/root-compilation.tsconfig.json | 2 +- .../src/machine/machines-picker.ts | 3 +- 27 files changed, 235 insertions(+), 647 deletions(-) rename extensions/{eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts => eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts} (96%) rename extensions/{eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts => eclipse-che-theia-plugin-ext/src/browser/che-languages-test-main.ts} (97%) rename extensions/{eclipse-che-theia-testing-service-ext/src/browser/plugin-handle-registry.ts => eclipse-che-theia-plugin-ext/src/browser/che-plugin-handle-registry.ts} (94%) rename extensions/{eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts => eclipse-che-theia-plugin-ext/src/common/che-languages-test-protocol.ts} (95%) delete mode 100644 extensions/eclipse-che-theia-testing-service-ext/.gitignore delete mode 100644 extensions/eclipse-che-theia-testing-service-ext/package.json delete mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/browser/test-api-provider.ts delete mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-api-frontend-provider.ts delete mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-ext-frontend-module.ts delete mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-api-node-provider.ts delete mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-ext-backend-module.ts delete mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts delete mode 100644 extensions/eclipse-che-theia-testing-service-ext/src/testservice-plugin-api-provider.ts delete mode 100644 extensions/eclipse-che-theia-testing-service-ext/tsconfig.json delete mode 100644 extensions/eclipse-che-theia-testing-service-ext/webpack.config.js delete mode 100644 extensions/eclipse-che-theia-testing-service/package.json delete mode 100644 extensions/eclipse-che-theia-testing-service/src/testing-service.d.ts delete mode 100644 extensions/eclipse-che-theia-testing-service/tsconfig.json diff --git a/che-theia-init-sources.yml b/che-theia-init-sources.yml index 639fed405..5c84ea507 100644 --- a/che-theia-init-sources.yml +++ b/che-theia-init-sources.yml @@ -12,8 +12,6 @@ sources: - extensions/eclipse-che-theia-about - extensions/eclipse-che-theia-preferences-provider-extension - extensions/eclipse-che-theia-git-provisioner - - extensions/eclipse-che-theia-testing-service-ext - - extensions/eclipse-che-theia-testing-service - extensions/eclipse-che-theia-logging - extensions/eclipse-che-theia-messaging - extensions/eclipse-che-theia-file-sync-tracker diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-api-provider.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-api-provider.ts index 32f9aa373..6efb52df7 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-api-provider.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-api-provider.ts @@ -25,6 +25,7 @@ import { CheSideCarContentReaderMainImpl } from './che-sidecar-content-reader-ma import { CheGithubMainImpl } from './che-github-main'; import { CheOpenshiftMainImpl } from './che-openshift-main'; import { CheOauthMainImpl } from './che-oauth-main'; +import { CheLanguagesTestAPIImpl } from './che-languages-test-api'; @injectable() export class CheApiProvider implements MainPluginApiProvider { @@ -43,6 +44,7 @@ export class CheApiProvider implements MainPluginApiProvider { rpc.set(PLUGIN_RPC_CONTEXT.CHE_USER_MAIN, new CheUserMainImpl(container)); rpc.set(PLUGIN_RPC_CONTEXT.CHE_PRODUCT_MAIN, new CheProductMainImpl(container, rpc)); rpc.set(PLUGIN_RPC_CONTEXT.CHE_SIDERCAR_CONTENT_READER_MAIN, new CheSideCarContentReaderMainImpl(container, rpc)); + rpc.set(PLUGIN_RPC_CONTEXT.CHE_LANGUAGES_TEST_API_MAIN, new CheLanguagesTestAPIImpl(container)); } } diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-frontend-module.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-frontend-module.ts index d5ca2ac8d..4de13455a 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-frontend-module.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-frontend-module.ts @@ -54,6 +54,11 @@ import { CheTaskResolver } from './che-task-resolver'; import { CheTaskTerminalWidgetManager } from './che-task-terminal-widget-manager'; import { TaskTerminalWidgetManager } from '@theia/task/lib/browser/task-terminal-widget-manager'; import { ContainerPicker } from './container-picker'; +import { ChePluginHandleRegistry } from './che-plugin-handle-registry'; +import { CheLanguagesMainTestImpl } from './che-languages-test-main'; +import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import { interfaces } from 'inversify'; +import { LanguagesMainFactory } from '@theia/plugin-ext'; export default new ContainerModule((bind, unbind, isBound, rebind) => { bind(CheApiProvider).toSelf().inSingletonScope(); @@ -122,4 +127,12 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { bind(CheTaskTerminalWidgetManager).toSelf().inSingletonScope(); rebind(TaskTerminalWidgetManager).toService(CheTaskTerminalWidgetManager); + + bind(ChePluginHandleRegistry).toSelf().inSingletonScope(); + bind(CheLanguagesMainTestImpl).toSelf().inTransientScope(); + rebind(LanguagesMainFactory).toFactory((context: interfaces.Context) => (rpc: RPCProtocol) => { + const child = context.container.createChild(); + child.bind(RPCProtocol).toConstantValue(rpc); + return child.get(CheLanguagesMainTestImpl); + }); }); diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts similarity index 96% rename from extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts rename to extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts index 48f5b1a92..e5a749fc8 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts @@ -8,9 +8,9 @@ * SPDX-License-Identifier: EPL-2.0 **********************************************************************/ -import { PluginHandleRegistry } from './plugin-handle-registry'; +import { ChePluginHandleRegistry } from './che-plugin-handle-registry'; import { interfaces } from 'inversify'; -import { TestAPI } from '../common/test-protocol'; +import { CheLanguagesTestAPI } from '../common/che-languages-test-protocol'; import { CompletionContext, CompletionResultDto, @@ -44,12 +44,12 @@ import { /** * This class redirects language api requests to the correct sidecars and returns the results */ -export class TestAPIImpl implements TestAPI { +export class CheLanguagesTestAPIImpl implements CheLanguagesTestAPI { - private readonly pluginHandleRegistry: PluginHandleRegistry; + private readonly pluginHandleRegistry: ChePluginHandleRegistry; constructor(container: interfaces.Container) { - this.pluginHandleRegistry = container.get(PluginHandleRegistry); + this.pluginHandleRegistry = container.get(ChePluginHandleRegistry); } async $provideCompletionItems(pluginID: string, resource: UriComponents, position: Position, @@ -106,7 +106,6 @@ export class TestAPIImpl implements TestAPI { return languagesExt.$provideDocumentFormattingEdits(handle, resource, options, token); } - // tslint:disable-next-line:no-any async $provideDocumentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, options: FormattingOptions, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentRangeFormattingEdits'); @@ -129,7 +128,6 @@ export class TestAPIImpl implements TestAPI { return languagesExt.$provideDocumentLinks(handle, resource, token); } - // tslint:disable-next-line:no-any async $provideCodeActions(pluginID: string, resource: UriComponents, rangeOrSelection: Range | Selection, diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-main.ts similarity index 97% rename from extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts rename to extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-main.ts index 93e692ada..6fa4661d1 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-main.ts @@ -13,7 +13,7 @@ import { PluginInfo, LanguagesExt, MAIN_RPC_CONTEXT } from '@theia/plugin-ext/li import { SerializedDocumentFilter, MarkerData } from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; import { LanguagesMainImpl } from '@theia/plugin-ext/lib/main/browser/languages-main'; import * as theia from '@theia/plugin'; -import { PluginHandleRegistry } from './plugin-handle-registry'; +import { ChePluginHandleRegistry } from './che-plugin-handle-registry'; import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; import { LanguagesMain, SerializedLanguageConfiguration } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; @@ -44,13 +44,13 @@ export type LanguageServerActions = 'renameEdits'; @injectable() -export class LanguagesMainTestImpl implements LanguagesMain { +export class CheLanguagesMainTestImpl implements LanguagesMain { @inject(LanguagesMainImpl) private readonly languagesMainImpl: LanguagesMainImpl; - @inject(PluginHandleRegistry) - private readonly pluginHandleRegistry: PluginHandleRegistry; + @inject(ChePluginHandleRegistry) + private readonly pluginHandleRegistry: ChePluginHandleRegistry; private readonly languagesExtProxy: LanguagesExt; diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/plugin-handle-registry.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-plugin-handle-registry.ts similarity index 94% rename from extensions/eclipse-che-theia-testing-service-ext/src/browser/plugin-handle-registry.ts rename to extensions/eclipse-che-theia-plugin-ext/src/browser/che-plugin-handle-registry.ts index f2537ff95..5ba8a95b5 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/src/browser/plugin-handle-registry.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-plugin-handle-registry.ts @@ -9,7 +9,7 @@ **********************************************************************/ import { injectable } from 'inversify'; -import { LanguageServerAction } from './languages-test-main'; +import { LanguageServerAction } from './che-languages-test-main'; import { LanguagesExt } from '@theia/plugin-ext'; import { Emitter } from '@theia/core/lib/common/event'; @@ -32,7 +32,7 @@ export interface LanguageRegistrationEvent extends LanguagesExtHandle { * This class keeps a registry of which plugins map to which handle */ @injectable() -export class PluginHandleRegistry { +export class ChePluginHandleRegistry { pluginRegistrationMap: Map = new Map(); private onRegisteredLanguageFeatureEmitter = new Emitter(); @@ -57,7 +57,7 @@ export class PluginHandleRegistry { const registeredLanguagesExt = this.findRegisteredLanguagesExt(pluginID, languageServerAction); if (!registeredLanguagesExt) { return new Promise(resolve => { - this.onRegisteredLanguageFeature(newRegistration => { + this.onRegisteredLanguageFeature((newRegistration: LanguageRegistrationEvent) => { if (newRegistration.pluginID === pluginID && newRegistration.action === languageServerAction) { return resolve(newRegistration); } diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts b/extensions/eclipse-che-theia-plugin-ext/src/common/che-languages-test-protocol.ts similarity index 95% rename from extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts rename to extensions/eclipse-che-theia-plugin-ext/src/common/che-languages-test-protocol.ts index 0c05aba1f..8e1c70da3 100644 --- a/extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/common/che-languages-test-protocol.ts @@ -37,10 +37,9 @@ import { RawColorInfo, WorkspaceEditDto } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; -import { createProxyIdentifier } from '@theia/plugin-ext/lib/common/rpc-protocol'; // Expose additional API that allows you to know if a language server is connected and build a map of the language servers -export interface TestAPI { +export interface CheLanguagesTestAPI { $provideCompletionItems(pluginID: string, resource: UriComponents, position: Position, context: CompletionContext, token: CancellationToken): Promise; $provideImplementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; @@ -85,7 +84,3 @@ export interface TestAPI { $provideDocumentColors(pluginID: string, resource: UriComponents, token: CancellationToken): PromiseLike; $provideRenameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: CancellationToken): PromiseLike; } - -export const PLUGIN_RPC_CONTEXT = { - TEST_API_MAIN: createProxyIdentifier('TestAPI'), -}; diff --git a/extensions/eclipse-che-theia-plugin-ext/src/common/che-protocol.ts b/extensions/eclipse-che-theia-plugin-ext/src/common/che-protocol.ts index 03b4bb3e9..797308167 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/common/che-protocol.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/common/che-protocol.ts @@ -12,6 +12,7 @@ import { che as cheApi } from '@eclipse-che/api'; import * as che from '@eclipse-che/plugin'; import { Event, JsonRpcServer } from '@theia/core'; import { createProxyIdentifier } from '@theia/plugin-ext/lib/common/rpc-protocol'; +import { CheLanguagesTestAPI } from './che-languages-test-protocol'; /** * Workspace plugin API @@ -445,6 +446,8 @@ export const PLUGIN_RPC_CONTEXT = { CHE_SIDERCAR_CONTENT_READER: createProxyIdentifier('CheSideCarContentReader'), CHE_SIDERCAR_CONTENT_READER_MAIN: createProxyIdentifier('CheSideCarContentReaderMain'), + + CHE_LANGUAGES_TEST_API_MAIN: createProxyIdentifier('CheLanguagesTestAPI') }; // Theia RPC protocol diff --git a/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts b/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts index c59b3c3e8..0ce2f8200 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts @@ -10,6 +10,7 @@ import { che as cheApi } from '@eclipse-che/api'; import * as che from '@eclipse-che/plugin'; +import * as theia from '@theia/plugin'; import { TaskStatusOptions } from '@eclipse-che/plugin'; import { Plugin } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; @@ -28,6 +29,34 @@ import { CheWorkspaceImpl } from './che-workspace'; import { CheOpenshiftImpl } from './che-openshift'; import { CheOauthImpl } from './che-oauth'; import { Disposable } from '@theia/core'; +import { + CompletionContext, + CompletionResultDto, + SignatureHelp, + Hover, + DocumentHighlight, + Range, + TextEdit, + FormattingOptions, + Definition, + DocumentLink, + CodeLensSymbol, + DocumentSymbol, + ReferenceContext, + Location, + SignatureHelpContext, + CodeActionContext, + CodeAction, + FoldingRange, +} from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; +import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; +import { SymbolInformation } from 'vscode-languageserver-types'; +import { + Position, + Selection, + RawColorInfo, + WorkspaceEditDto +} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; export interface CheApiFactory { (plugin: Plugin): typeof che; @@ -49,6 +78,8 @@ export function createAPIFactory(rpc: RPCProtocol): CheApiFactory { const cheProductImpl = rpc.set(PLUGIN_RPC_CONTEXT.CHE_PRODUCT, new CheProductImpl(rpc)); const cheTelemetryImpl = rpc.set(PLUGIN_RPC_CONTEXT.CHE_TELEMETRY, new CheTelemetryImpl(rpc)); + const languageTestAPI = rpc.getProxy(PLUGIN_RPC_CONTEXT.CHE_LANGUAGES_TEST_API_MAIN); + return function (plugin: Plugin): typeof che { const workspace: typeof che.workspace = { getCurrentWorkspace(): Promise { @@ -228,6 +259,97 @@ export function createAPIFactory(rpc: RPCProtocol): CheApiFactory { } }; + const languagesTest: typeof che.languages.test = { + + completion(pluginID: string, resource: UriComponents, position: Position, + context: CompletionContext, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideCompletionItems(pluginID, resource, position, context, token); + }, + implementation(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideImplementation(pluginID, resource, position, token); + }, + typeDefinition(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideTypeDefinition(pluginID, resource, position, token); + }, + definition(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideDefinition(pluginID, resource, position, token); + }, + declaration(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideDeclaration(pluginID, resource, position, token); + }, + references(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideReferences(pluginID, resource, position, context, token); + }, + signatureHelp( + pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: theia.CancellationToken + ): Promise { + return languageTestAPI.$provideSignatureHelp(pluginID, resource, position, context, token); + }, + hover(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideHover(pluginID, resource, position, token); + }, + documentHighlights(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideDocumentHighlights(pluginID, resource, position, token); + }, + documentFormattingEdits(pluginID: string, resource: UriComponents, + options: FormattingOptions, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideDocumentFormattingEdits(pluginID, resource, options, token); + }, + documentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, + options: FormattingOptions, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideDocumentRangeFormattingEdits(pluginID, resource, range, options, token); + }, + onTypeFormattingEdits( + pluginID: string, + resource: UriComponents, + position: Position, + ch: string, + options: FormattingOptions, + token: theia.CancellationToken + ): Promise { + return languageTestAPI.$provideOnTypeFormattingEdits(pluginID, resource, position, ch, options, token); + }, + documentLinks(pluginID: string, resource: UriComponents, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideDocumentLinks(pluginID, resource, token); + }, + codeLenses(pluginID: string, resource: UriComponents, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideCodeLenses(pluginID, resource, token); + }, + codeActions( + pluginID: string, + resource: UriComponents, + rangeOrSelection: Range | Selection, + context: CodeActionContext, + token: theia.CancellationToken + ): Promise { + return languageTestAPI.$provideCodeActions(pluginID, resource, rangeOrSelection, context, token); + }, + documentSymbols(pluginID: string, resource: UriComponents, token: theia.CancellationToken): Promise { + return languageTestAPI.$provideDocumentSymbols(pluginID, resource, token); + }, + workspaceSymbols(pluginID: string, query: string, token: theia.CancellationToken): PromiseLike { + return languageTestAPI.$provideWorkspaceSymbols(pluginID, query, token); + }, + foldingRange( + pluginID: string, + resource: UriComponents, + context: theia.FoldingContext, + token: theia.CancellationToken + ): PromiseLike { + return languageTestAPI.$provideFoldingRange(pluginID, resource, context, token); + }, + documentColors(pluginID: string, resource: UriComponents, token: theia.CancellationToken): PromiseLike { + return languageTestAPI.$provideDocumentColors(pluginID, resource, token); + }, + renameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: theia.CancellationToken): PromiseLike { + return languageTestAPI.$provideRenameEdits(pluginID, resource, position, newName, token); + } + }; + + const languages: typeof che.languages = { + test: languagesTest + }; + return { workspace, factory, @@ -242,7 +364,8 @@ export function createAPIFactory(rpc: RPCProtocol): CheApiFactory { oAuth, telemetry, TaskStatus, - TaskTerminallKind + TaskTerminallKind, + languages }; }; diff --git a/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts b/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts index c1648b429..b609543b5 100644 --- a/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts +++ b/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts @@ -15,6 +15,34 @@ import { che as cheApi } from '@eclipse-che/api' import * as theia from '@theia/plugin'; +import { + CompletionContext, + CompletionResultDto, + SignatureHelp, + Hover, + DocumentHighlight, + Range, + TextEdit, + FormattingOptions, + Definition, + DocumentLink, + CodeLensSymbol, + DocumentSymbol, + ReferenceContext, + Location, + SignatureHelpContext, + CodeActionContext, + CodeAction, + FoldingRange, +} from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; +import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; +import { SymbolInformation } from 'vscode-languageserver-types'; +import { + Position, + Selection, + RawColorInfo, + WorkspaceEditDto +} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; declare module '@eclipse-che/plugin' { @@ -301,4 +329,52 @@ declare module '@eclipse-che/plugin' { export let links: LinkMap; } + export namespace languages { + export namespace test { + export function completion(pluginID: string, resource: UriComponents, position: Position, + context: CompletionContext, token: theia.CancellationToken): Promise; + export function implementation(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise; + export function typeDefinition(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise; + export function definition(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise; + export function declaration(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise; + export function references(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: theia.CancellationToken): Promise; + export function signatureHelp( + pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: theia.CancellationToken + ): Promise; + export function hover(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise; + export function documentHighlights(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise; + export function documentFormattingEdits(pluginID: string, resource: UriComponents, + options: FormattingOptions, token: theia.CancellationToken): Promise; + export function documentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, + options: FormattingOptions, token: theia.CancellationToken): Promise; + export function onTypeFormattingEdits( + pluginID: string, + resource: UriComponents, + position: Position, + ch: string, + options: FormattingOptions, + token: theia.CancellationToken + ): Promise; + export function documentLinks(pluginID: string, resource: UriComponents, token: theia.CancellationToken): Promise; + export function codeLenses(pluginID: string, resource: UriComponents, token: theia.CancellationToken): Promise; + export function codeActions( + pluginID: string, + resource: UriComponents, + rangeOrSelection: Range | Selection, + context: CodeActionContext, + token: theia.CancellationToken + ): Promise; + export function documentSymbols(pluginID: string, resource: UriComponents, token: theia.CancellationToken): Promise; + export function workspaceSymbols(pluginID: string, query: string, token: theia.CancellationToken): PromiseLike; + export function foldingRange( + pluginID: string, + resource: UriComponents, + context: theia.FoldingContext, + token: theia.CancellationToken + ): PromiseLike; + export function documentColors(pluginID: string, resource: UriComponents, token: theia.CancellationToken): PromiseLike; + export function renameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: theia.CancellationToken): PromiseLike; + } + } + } diff --git a/extensions/eclipse-che-theia-testing-service-ext/.gitignore b/extensions/eclipse-che-theia-testing-service-ext/.gitignore deleted file mode 100644 index a65b41774..000000000 --- a/extensions/eclipse-che-theia-testing-service-ext/.gitignore +++ /dev/null @@ -1 +0,0 @@ -lib diff --git a/extensions/eclipse-che-theia-testing-service-ext/package.json b/extensions/eclipse-che-theia-testing-service-ext/package.json deleted file mode 100644 index d355cb3f7..000000000 --- a/extensions/eclipse-che-theia-testing-service-ext/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "@eclipse-che/testing-service-ext", - "version": "0.0.1", - "description": "Theia - TestService Extension", - "dependencies": { - "@theia/plugin": "next", - "@theia/plugin-ext": "next", - "@eclipse-che/testing-service": "^0.0.1", - "glob": "^7.1.6", - "mocha": "^3.4.2" - }, - "publishConfig": { - "access": "public" - }, - "theiaExtensions": [ - { - "backend": "lib/node/testservice-ext-backend-module", - "frontend": "lib/browser/testservice-ext-frontend-module" - } - ], - "keywords": [ - "theia-extension" - ], - "license": "EPL-2.0", - "files": [ - "lib", - "src" - ], - "scripts": { - "prepare": "yarn clean && yarn build", - "clean": "rimraf lib", - "format": "tsfmt -r --useTsfmt ../../configs/tsfmt.json", - "lint": "eslint --cache=true --no-error-on-unmatched-pattern=true \"{src,test}/**/*.{ts,tsx}\"", - "compile": "tsc", - "build": "concurrently -n \"format,lint,compile\" -c \"red,green,blue\" \"yarn format\" \"yarn lint\" \"yarn compile\" && yarn run compileWorker", - "compileWorker": "webpack-cli --config webpack.config.js", - "watch": "tsc -w" - }, - "devDependencies": { - "clean-webpack-plugin": "^0.1.19", - "ts-loader": "^4.1.0", - "webpack": "^4.20.2", - "webpack-cli": "^3.1.1", - "typescript-formatter": "7.2.2", - "@types/js-yaml": "3.11.2" - } -} diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/test-api-provider.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/test-api-provider.ts deleted file mode 100644 index f49085aca..000000000 --- a/extensions/eclipse-che-theia-testing-service-ext/src/browser/test-api-provider.ts +++ /dev/null @@ -1,24 +0,0 @@ -/********************************************************************* - * Copyright (c) 2020 Red Hat, Inc. - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ - -import { MainPluginApiProvider } from '@theia/plugin-ext/lib/common/plugin-ext-api-contribution'; -import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; -import { injectable, interfaces } from 'inversify'; -import { PLUGIN_RPC_CONTEXT } from '../common/test-protocol'; -import { TestAPIImpl } from './languages-test-api'; - -@injectable() -export class TestApiProvider implements MainPluginApiProvider { - - initialize(rpc: RPCProtocol, container: interfaces.Container): void { - rpc.set(PLUGIN_RPC_CONTEXT.TEST_API_MAIN, new TestAPIImpl(container)); - } - -} diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-api-frontend-provider.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-api-frontend-provider.ts deleted file mode 100644 index 765ce0cfd..000000000 --- a/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-api-frontend-provider.ts +++ /dev/null @@ -1,47 +0,0 @@ -/********************************************************************* - * Copyright (c) 2020 Red Hat, Inc. - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ - -import { Plugin, emptyPlugin } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; -import { ExtPluginApiFrontendInitializationFn } from '@theia/plugin-ext/lib/common/plugin-ext-api-contribution'; -import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; -import * as testService from '@eclipse-che/testing-service'; -import { createAPIFactory } from '../plugin/testservice-api'; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const ctx = self as any; -const pluginsApiImpl = new Map(); -let defaultApi: typeof testService; - -export const initializeApi: ExtPluginApiFrontendInitializationFn = (rpc: RPCProtocol, plugins: Map) => { - const TestServiceApiFactory = createAPIFactory(rpc); - const handler = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - get: (target: any, name: string) => { - const plugin = plugins.get(name); - if (plugin) { - let apiImpl = pluginsApiImpl.get(plugin.model.id); - if (!apiImpl) { - apiImpl = TestServiceApiFactory(plugin); - pluginsApiImpl.set(plugin.model.id, apiImpl); - } - return apiImpl; - } - - if (!defaultApi) { - defaultApi = TestServiceApiFactory(emptyPlugin); - } - - return defaultApi; - } - }; - - // eslint-disable-next-line no-null/no-null - ctx['test'] = new Proxy(Object.create(null), handler); -}; diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-ext-frontend-module.ts b/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-ext-frontend-module.ts deleted file mode 100644 index 5f83e49c1..000000000 --- a/extensions/eclipse-che-theia-testing-service-ext/src/browser/testservice-ext-frontend-module.ts +++ /dev/null @@ -1,29 +0,0 @@ -/********************************************************************* - * Copyright (c) 2020 Red Hat, Inc. - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ - -import { ContainerModule } from 'inversify'; -import { PluginHandleRegistry } from './plugin-handle-registry'; -import { TestApiProvider } from './test-api-provider'; -import { MainPluginApiProvider, LanguagesMainFactory } from '@theia/plugin-ext'; -import { LanguagesMainTestImpl } from './languages-test-main'; -import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; - -export default new ContainerModule((bind, unbind, isBound, rebind) => { - bind(TestApiProvider).toSelf().inSingletonScope(); - bind(MainPluginApiProvider).toService(TestApiProvider); - - bind(PluginHandleRegistry).toSelf().inSingletonScope(); - bind(LanguagesMainTestImpl).toSelf().inTransientScope(); - rebind(LanguagesMainFactory).toFactory(context => (rpc: RPCProtocol) => { - const child = context.container.createChild(); - child.bind(RPCProtocol).toConstantValue(rpc); - return child.get(LanguagesMainTestImpl); - }); -}); diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-api-node-provider.ts b/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-api-node-provider.ts deleted file mode 100644 index 5ae04efc1..000000000 --- a/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-api-node-provider.ts +++ /dev/null @@ -1,67 +0,0 @@ -/********************************************************************* - * Copyright (c) 2020 Red Hat, Inc. - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ - -import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; -import { Plugin, emptyPlugin } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; -import { ExtPluginApiBackendInitializationFn } from '@theia/plugin-ext'; -import * as testService from '@eclipse-che/testing-service'; -import { PluginManager } from '@theia/plugin-ext'; -import { createAPIFactory, TestApiFactory } from '../plugin/testservice-api'; - -const pluginsApiImpl = new Map(); -let defaultApi: typeof testService; -let isLoadOverride = false; -let TestServiceApiFactory: TestApiFactory; -let plugins: PluginManager; - -export const provideApi: ExtPluginApiBackendInitializationFn = (rpc: RPCProtocol, pluginManager: PluginManager) => { - TestServiceApiFactory = createAPIFactory(rpc); - plugins = pluginManager; - - if (!isLoadOverride) { - overrideInternalLoad(); - isLoadOverride = true; - } - -}; - -function overrideInternalLoad(): void { - const module = require('module'); - // save original load method - const internalLoad = module._load; - - // if we try to resolve @eclipse-che/testing-service module, return the filename entry to use cache. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - module._load = function (request: string, parent: any, isMain: {}): any { - if (request !== '@eclipse-che/testing-service') { - return internalLoad.apply(this, arguments); - } - - const plugin = findPlugin(parent.filename); - if (plugin) { - let apiImpl = pluginsApiImpl.get(plugin.model.id); - if (!apiImpl) { - apiImpl = TestServiceApiFactory(plugin); - pluginsApiImpl.set(plugin.model.id, apiImpl); - } - return apiImpl; - } - - if (!defaultApi) { - defaultApi = TestServiceApiFactory(emptyPlugin); - } - - return defaultApi; - }; -} - -function findPlugin(filePath: string): Plugin | undefined { - return plugins.getAllPlugins().find(plugin => filePath.startsWith(plugin.pluginFolder)); -} diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-ext-backend-module.ts b/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-ext-backend-module.ts deleted file mode 100644 index 1287f718d..000000000 --- a/extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-ext-backend-module.ts +++ /dev/null @@ -1,18 +0,0 @@ -/********************************************************************* - * Copyright (c) 2020 Red Hat, Inc. - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ - -import { ContainerModule } from 'inversify'; -import { TestServerPluginApiProvider } from '../testservice-plugin-api-provider'; -import { ExtPluginApiProvider } from '@theia/plugin-ext'; - -export default new ContainerModule(bind => { - bind(TestServerPluginApiProvider).toSelf().inSingletonScope(); - bind(Symbol.for(ExtPluginApiProvider)).toService(TestServerPluginApiProvider); -}); diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts b/extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts deleted file mode 100644 index c11923f38..000000000 --- a/extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts +++ /dev/null @@ -1,147 +0,0 @@ -/********************************************************************* - * Copyright (c) 2020 Red Hat, Inc. - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ - -import { RPCProtocol } from '@theia/plugin-ext/lib/common/rpc-protocol'; -import { Plugin } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; -import * as testservice from '@eclipse-che/testing-service'; -import { PLUGIN_RPC_CONTEXT } from '../common/test-protocol'; -import { - CompletionContext, - CompletionResultDto, - SignatureHelp, - Hover, - DocumentHighlight, - Range, - TextEdit, - FormattingOptions, - Definition, - DocumentLink, - CodeLensSymbol, - DocumentSymbol, - ReferenceContext, - Location, - SignatureHelpContext, - CodeActionContext, - CodeAction, - FoldingRange, -} from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; -import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; -import { CancellationToken, FoldingContext } from '@theia/plugin'; -import { SymbolInformation } from 'vscode-languageserver-types'; -import { - Position, - Selection, - RawColorInfo, - WorkspaceEditDto -} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; - -export interface TestApiFactory { - (plugin: Plugin): typeof testservice; -} - -export function createAPIFactory(rpc: RPCProtocol): TestApiFactory { - - return function (plugin: Plugin): typeof testservice { - - const testAPI = rpc.getProxy(PLUGIN_RPC_CONTEXT.TEST_API_MAIN); - - const languageserver: typeof testservice.languageserver = { - - completion(pluginID: string, resource: UriComponents, position: Position, - context: CompletionContext, token: CancellationToken): Promise { - return testAPI.$provideCompletionItems(pluginID, resource, position, context, token); - }, - implementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { - return testAPI.$provideImplementation(pluginID, resource, position, token); - }, - typeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { - return testAPI.$provideTypeDefinition(pluginID, resource, position, token); - }, - definition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { - return testAPI.$provideDefinition(pluginID, resource, position, token); - }, - declaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { - return testAPI.$provideDeclaration(pluginID, resource, position, token); - }, - references(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: CancellationToken): Promise { - return testAPI.$provideReferences(pluginID, resource, position, context, token); - }, - signatureHelp( - pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: CancellationToken - ): Promise { - return testAPI.$provideSignatureHelp(pluginID, resource, position, context, token); - }, - hover(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { - return testAPI.$provideHover(pluginID, resource, position, token); - }, - documentHighlights(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { - return testAPI.$provideDocumentHighlights(pluginID, resource, position, token); - }, - documentFormattingEdits(pluginID: string, resource: UriComponents, - options: FormattingOptions, token: CancellationToken): Promise { - return testAPI.$provideDocumentFormattingEdits(pluginID, resource, options, token); - }, - documentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, - options: FormattingOptions, token: CancellationToken): Promise { - return testAPI.$provideDocumentRangeFormattingEdits(pluginID, resource, range, options, token); - }, - onTypeFormattingEdits( - pluginID: string, - resource: UriComponents, - position: Position, - ch: string, - options: FormattingOptions, - token: CancellationToken - ): Promise { - return testAPI.$provideOnTypeFormattingEdits(pluginID, resource, position, ch, options, token); - }, - documentLinks(pluginID: string, resource: UriComponents, token: CancellationToken): Promise { - return testAPI.$provideDocumentLinks(pluginID, resource, token); - }, - codeLenses(pluginID: string, resource: UriComponents, token: CancellationToken): Promise { - return testAPI.$provideCodeLenses(pluginID, resource, token); - }, - codeActions( - pluginID: string, - resource: UriComponents, - rangeOrSelection: Range | Selection, - context: CodeActionContext, - token: CancellationToken - ): Promise { - return testAPI.$provideCodeActions(pluginID, resource, rangeOrSelection, context, token); - }, - documentSymbols(pluginID: string, resource: UriComponents, token: CancellationToken): Promise { - return testAPI.$provideDocumentSymbols(pluginID, resource, token); - }, - workspaceSymbols(pluginID: string, query: string, token: CancellationToken): PromiseLike { - return testAPI.$provideWorkspaceSymbols(pluginID, query, token); - }, - foldingRange( - pluginID: string, - resource: UriComponents, - context: FoldingContext, - token: CancellationToken - ): PromiseLike { - return testAPI.$provideFoldingRange(pluginID, resource, context, token); - }, - documentColors(pluginID: string, resource: UriComponents, token: CancellationToken): PromiseLike { - return testAPI.$provideDocumentColors(pluginID, resource, token); - }, - renameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: CancellationToken): PromiseLike { - return testAPI.$provideRenameEdits(pluginID, resource, position, newName, token); - } - }; - - return { - languageserver - }; - - }; -} diff --git a/extensions/eclipse-che-theia-testing-service-ext/src/testservice-plugin-api-provider.ts b/extensions/eclipse-che-theia-testing-service-ext/src/testservice-plugin-api-provider.ts deleted file mode 100644 index a067ad607..000000000 --- a/extensions/eclipse-che-theia-testing-service-ext/src/testservice-plugin-api-provider.ts +++ /dev/null @@ -1,28 +0,0 @@ -/********************************************************************* - * Copyright (c) 2020 Red Hat, Inc. - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ - -import { injectable } from 'inversify'; -import { ExtPluginApiProvider, ExtPluginApi } from '@theia/plugin-ext'; -import * as path from 'path'; - -@injectable() -export class TestServerPluginApiProvider implements ExtPluginApiProvider { - - provideApi(): ExtPluginApi { - return { - frontendExtApi: { - initPath: './browser/testservice-api-frontend-provider.js', - initFunction: 'initializeApi', - initVariable: 'testserver_api_provider' - }, - backendInitPath: path.join(__dirname, './node/testservice-api-node-provider.js') - }; - } -} diff --git a/extensions/eclipse-che-theia-testing-service-ext/tsconfig.json b/extensions/eclipse-che-theia-testing-service-ext/tsconfig.json deleted file mode 100644 index e524f781e..000000000 --- a/extensions/eclipse-che-theia-testing-service-ext/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../configs/base.tsconfig", - "compilerOptions": { - "lib": [ - "es6", - "dom" - ], - "sourceMap": true, - "rootDir": "src", - "outDir": "lib", - "skipLibCheck": true, - "jsx": "react" - }, - "include": [ - "src/**/*.ts" - ] -} diff --git a/extensions/eclipse-che-theia-testing-service-ext/webpack.config.js b/extensions/eclipse-che-theia-testing-service-ext/webpack.config.js deleted file mode 100644 index ce53911ad..000000000 --- a/extensions/eclipse-che-theia-testing-service-ext/webpack.config.js +++ /dev/null @@ -1,49 +0,0 @@ -/********************************************************************* - * Copyright (c) 2018 Red Hat, Inc. - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ - -const path = require('path'); -const CleanWebpackPlugin = require('clean-webpack-plugin'); - -module.exports = { - entry: './lib/browser/testservice-api-frontend-provider.js', - devtool: 'source-map', - mode: 'production', - node: { - fs: 'empty', - child_process: 'empty', - net: 'empty', - crypto: 'empty' - }, - module: { - rules: [ - { - test: /\.ts$/, - use: [ - { - loader: 'ts-loader', - options: { - transpileOnly: true - } - } - ], - exclude: /node_modules/ - } - ] - }, - resolve: { - extensions: ['.ts', '.js'] - }, - output: { - filename: 'testservice-api-frontend-provider.js', - libraryTarget: "var", - library: "testserver_api_provider", - path: path.resolve(__dirname, 'lib/browser') - } -}; diff --git a/extensions/eclipse-che-theia-testing-service/package.json b/extensions/eclipse-che-theia-testing-service/package.json deleted file mode 100644 index 3b7db95ac..000000000 --- a/extensions/eclipse-che-theia-testing-service/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "@eclipse-che/testing-service", - "version": "0.0.1", - "description": "Theia - Testing Service API", - "types": "./src/testing-service.d.ts", - "publishConfig": { - "access": "public" - }, - "license": "EPL-2.0", - "repository": { - "type": "git", - "url": "https://github.com/eclipse/che-theia.git" - }, - "bugs": { - "url": "https://github.com/eclipse/che/issues" - }, - "homepage": "https://github.com/eclipse/che", - "files": [ - "src", - "lib" - ], - "scripts": { - "prepare": "yarn run clean && yarn run build", - "clean": "rimraf lib", - "format": "tsfmt -r --useTsfmt ../../configs/tsfmt.json", - "lint": "eslint --cache=true --no-error-on-unmatched-pattern=true \"{src,test}/**/*.{ts,tsx}\"", - "compile": "tsc", - "build": "concurrently -n \"format,lint,compile\" -c \"red,green,blue\" \"yarn format\" \"yarn lint\" \"yarn compile\"", - "watch": "tsc -w" - }, - "dependencies": { - "@theia/plugin": "next", - "@theia/plugin-ext": "next" - }, - "devDependencies": {} -} diff --git a/extensions/eclipse-che-theia-testing-service/src/testing-service.d.ts b/extensions/eclipse-che-theia-testing-service/src/testing-service.d.ts deleted file mode 100644 index 490a43aa9..000000000 --- a/extensions/eclipse-che-theia-testing-service/src/testing-service.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************** - * Copyright (C) 2018 Red Hat, Inc. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the Eclipse - * Public License v. 2.0 are satisfied: GNU General Public License, version 2 - * with the GNU Classpath Exception which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - ********************************************************************************/ - -import * as vst from 'vscode-languageserver-types'; -import { - CompletionContext, - CompletionResultDto, - SignatureHelp, - Hover, - DocumentHighlight, - Range, - TextEdit, - FormattingOptions, - Definition, - DefinitionLink, - DocumentLink, - CodeLensSymbol, - DocumentSymbol, - ReferenceContext, - Location, - SignatureHelpContext, - CodeActionContext, - CodeAction, - FoldingRange, -} from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; -import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; -import { CancellationToken, FoldingContext } from '@theia/plugin'; -import { SymbolInformation } from 'vscode-languageserver-types'; -import { - Position, - Selection, - RawColorInfo, - WorkspaceEditDto -} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; - -declare module '@eclipse-che/testing-service' { - - export namespace languageserver { - export function completion(pluginID: string, resource: UriComponents, position: Position, - context: CompletionContext, token: CancellationToken): Promise; - export function implementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - export function typeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - export function definition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - export function declaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - export function references(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: CancellationToken): Promise; - export function signatureHelp( - pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: CancellationToken - ): Promise; - export function hover(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - export function documentHighlights(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - export function documentFormattingEdits(pluginID: string, resource: UriComponents, - options: FormattingOptions, token: CancellationToken): Promise; - export function documentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, - options: FormattingOptions, token: CancellationToken): Promise; - export function onTypeFormattingEdits( - pluginID: string, - resource: UriComponents, - position: Position, - ch: string, - options: FormattingOptions, - token: CancellationToken - ): Promise; - export function documentLinks(pluginID: string, resource: UriComponents, token: CancellationToken): Promise; - export function codeLenses(pluginID: string, resource: UriComponents, token: CancellationToken): Promise; - export function codeActions( - pluginID: string, - resource: UriComponents, - rangeOrSelection: Range | Selection, - context: CodeActionContext, - token: CancellationToken - ): Promise; - export function documentSymbols(pluginID: string, resource: UriComponents, token: CancellationToken): Promise; - export function workspaceSymbols(pluginID: string, query: string, token: CancellationToken): PromiseLike; - export function foldingRange( - pluginID: string, - resource: UriComponents, - context: FoldingContext, - token: CancellationToken - ): PromiseLike; - export function documentColors(pluginID: string, resource: UriComponents, token: CancellationToken): PromiseLike; - export function renameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: CancellationToken): PromiseLike; - } - -} diff --git a/extensions/eclipse-che-theia-testing-service/tsconfig.json b/extensions/eclipse-che-theia-testing-service/tsconfig.json deleted file mode 100644 index a6a832536..000000000 --- a/extensions/eclipse-che-theia-testing-service/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../configs/base.tsconfig.json", - "compilerOptions": { - "lib": [ - "es6", - "dom" - ], - "rootDir": "src", - "outDir": "lib" - }, - "include": [ - "src" - ] -} diff --git a/extensions/eclipse-che-theia-workspace/src/browser/che-workspace-controller.ts b/extensions/eclipse-che-theia-workspace/src/browser/che-workspace-controller.ts index b981221cb..a074971b6 100644 --- a/extensions/eclipse-che-theia-workspace/src/browser/che-workspace-controller.ts +++ b/extensions/eclipse-che-theia-workspace/src/browser/che-workspace-controller.ts @@ -81,7 +81,7 @@ export class CheWorkspaceController { } private doOpenWorkspace(recent: boolean): Promise { - return this.quickOpenWorkspace.select(recent, async (workspace: che.workspace.Workspace) => { + return this.quickOpenWorkspace.select(recent, async (workspace: che.workspace.Workspace) => { const dialog = new StopWorkspaceDialog(); const result = await dialog.open(); if (typeof result === 'boolean') { diff --git a/generator/tests/init-sources/assembly-example/configs/root-compilation.tsconfig.json b/generator/tests/init-sources/assembly-example/configs/root-compilation.tsconfig.json index b433ca3d8..fafeee5db 100644 --- a/generator/tests/init-sources/assembly-example/configs/root-compilation.tsconfig.json +++ b/generator/tests/init-sources/assembly-example/configs/root-compilation.tsconfig.json @@ -164,4 +164,4 @@ "path": "../examples/assembly/compile.tsconfig.json" } ] -} +} \ No newline at end of file diff --git a/plugins/task-plugin/src/machine/machines-picker.ts b/plugins/task-plugin/src/machine/machines-picker.ts index 19a3ae62b..8e1e8f474 100644 --- a/plugins/task-plugin/src/machine/machines-picker.ts +++ b/plugins/task-plugin/src/machine/machines-picker.ts @@ -47,7 +47,8 @@ export class MachinesPicker { window.showQuickPick(items, { placeHolder: CONTAINERS_PLACE_HOLDER, ignoreFocusOut: false, - onDidSelectItem: (item => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onDidSelectItem: ((item: any) => { resolve((item).label); }) }); From c3bdcf64b7c07c70d358c0ab8a1aecd86795a08f Mon Sep 17 00:00:00 2001 From: svor Date: Wed, 12 Aug 2020 11:26:28 +0300 Subject: [PATCH 06/12] Add empty line Signed-off-by: svor --- .../assembly-example/configs/root-compilation.tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator/tests/init-sources/assembly-example/configs/root-compilation.tsconfig.json b/generator/tests/init-sources/assembly-example/configs/root-compilation.tsconfig.json index fafeee5db..b433ca3d8 100644 --- a/generator/tests/init-sources/assembly-example/configs/root-compilation.tsconfig.json +++ b/generator/tests/init-sources/assembly-example/configs/root-compilation.tsconfig.json @@ -164,4 +164,4 @@ "path": "../examples/assembly/compile.tsconfig.json" } ] -} \ No newline at end of file +} From e878e91b3d02eccdd8bc4a4f044db0b22b9c440a Mon Sep 17 00:00:00 2001 From: svor Date: Wed, 12 Aug 2020 11:32:14 +0300 Subject: [PATCH 07/12] Add empty line Signed-off-by: svor --- yarn.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index dbe95c4f0..70c6e4c1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17213,4 +17213,5 @@ zip-stream@^1.2.0: archiver-utils "^1.3.0" compress-commons "^1.2.0" lodash "^4.8.0" - readable-stream "^2.0.0" \ No newline at end of file + readable-stream "^2.0.0" + \ No newline at end of file From 98e6a84058417faa875eda81187105c068f14114 Mon Sep 17 00:00:00 2001 From: svor Date: Wed, 12 Aug 2020 11:33:08 +0300 Subject: [PATCH 08/12] Add empty line Signed-off-by: svor --- yarn.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 70c6e4c1b..85a0e4d1f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17214,4 +17214,3 @@ zip-stream@^1.2.0: compress-commons "^1.2.0" lodash "^4.8.0" readable-stream "^2.0.0" - \ No newline at end of file From 6f8224fe0062a864a915f8fe9e672150ff18c6e8 Mon Sep 17 00:00:00 2001 From: svor Date: Wed, 12 Aug 2020 14:24:10 +0300 Subject: [PATCH 09/12] use thei.Uri instead of plugin-ext/lib/common/uri-components.UriComponents Signed-off-by: svor --- .../src/browser/che-languages-test-api.ts | 41 +++++++++---------- .../src/common/che-languages-test-protocol.ts | 41 +++++++++---------- .../src/plugin/che-api.ts | 39 +++++++++--------- .../src/che-proposed.d.ts | 39 +++++++++--------- 4 files changed, 78 insertions(+), 82 deletions(-) diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts index e5a749fc8..a736dd148 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts @@ -31,8 +31,7 @@ import { CodeAction, FoldingRange, } from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; -import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; -import { CancellationToken, FoldingContext } from '@theia/plugin'; +import { CancellationToken, FoldingContext, Uri } from '@theia/plugin'; import { SymbolInformation } from 'vscode-languageserver-types'; import { Position, @@ -52,44 +51,44 @@ export class CheLanguagesTestAPIImpl implements CheLanguagesTestAPI { this.pluginHandleRegistry = container.get(ChePluginHandleRegistry); } - async $provideCompletionItems(pluginID: string, resource: UriComponents, position: Position, + async $provideCompletionItems(pluginID: string, resource: Uri, position: Position, context: CompletionContext, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'completion'); return languagesExt.$provideCompletionItems(handle, resource, position, context, token); } - async $provideDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + async $provideDefinition(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'definition'); return languagesExt.$provideDefinition(handle, resource, position, token); } - async $provideDeclaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + async $provideDeclaration(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'declaration'); return languagesExt.$provideDeclaration(handle, resource, position, token); } - async $provideSignatureHelp(pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: CancellationToken + async $provideSignatureHelp(pluginID: string, resource: Uri, position: Position, context: SignatureHelpContext, token: CancellationToken ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'signatureHelp'); return languagesExt.$provideSignatureHelp(handle, resource, position, context, token); } - async $provideImplementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + async $provideImplementation(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'implementation'); return languagesExt.$provideImplementation(handle, resource, position, token); } - async $provideTypeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + async $provideTypeDefinition(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'typeDefinition'); return languagesExt.$provideTypeDefinition(handle, resource, position, token); } - async $provideHover(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + async $provideHover(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'hover'); return languagesExt.$provideHover(handle, resource, position, token); } - async $provideDocumentHighlights(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise { + async $provideDocumentHighlights(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentHighlight'); return languagesExt.$provideDocumentHighlights(handle, resource, position, token); } @@ -100,20 +99,20 @@ export class CheLanguagesTestAPIImpl implements CheLanguagesTestAPI { ); } - async $provideDocumentFormattingEdits(pluginID: string, resource: UriComponents, + async $provideDocumentFormattingEdits(pluginID: string, resource: Uri, options: FormattingOptions, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentFormattingEdits'); return languagesExt.$provideDocumentFormattingEdits(handle, resource, options, token); } - async $provideDocumentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, + async $provideDocumentRangeFormattingEdits(pluginID: string, resource: Uri, range: Range, options: FormattingOptions, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentRangeFormattingEdits'); return languagesExt.$provideDocumentRangeFormattingEdits(handle, resource, range, options, token); } async $provideOnTypeFormattingEdits(pluginID: string, - resource: UriComponents, + resource: Uri, position: Position, ch: string, options: FormattingOptions, @@ -123,13 +122,13 @@ export class CheLanguagesTestAPIImpl implements CheLanguagesTestAPI { return languagesExt.$provideOnTypeFormattingEdits(handle, resource, position, ch, options, token); } - async $provideDocumentLinks(pluginID: string, resource: UriComponents, token: CancellationToken): Promise { + async $provideDocumentLinks(pluginID: string, resource: Uri, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentLinks'); return languagesExt.$provideDocumentLinks(handle, resource, token); } async $provideCodeActions(pluginID: string, - resource: UriComponents, + resource: Uri, rangeOrSelection: Range | Selection, context: CodeActionContext, token: CancellationToken @@ -138,24 +137,24 @@ export class CheLanguagesTestAPIImpl implements CheLanguagesTestAPI { return languagesExt.$provideCodeActions(handle, resource, rangeOrSelection, context, token); } - async $provideCodeLenses(pluginID: string, resource: UriComponents, token: CancellationToken): Promise { + async $provideCodeLenses(pluginID: string, resource: Uri, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'codeLenses'); return languagesExt.$provideCodeLenses(handle, resource, token); } - async $provideReferences(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: CancellationToken): Promise { + async $provideReferences(pluginID: string, resource: Uri, position: Position, context: ReferenceContext, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'references'); return languagesExt.$provideReferences(handle, resource, position, context, token); } - $provideDocumentColors(pluginID: string, resource: UriComponents, token: CancellationToken): PromiseLike { + $provideDocumentColors(pluginID: string, resource: Uri, token: CancellationToken): PromiseLike { return this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentColors').then(({ languagesExt, handle }) => languagesExt.$provideDocumentColors(handle, resource, token) ); } $provideFoldingRange(pluginID: string, - resource: UriComponents, + resource: Uri, context: FoldingContext, token: CancellationToken ): PromiseLike { @@ -164,13 +163,13 @@ export class CheLanguagesTestAPIImpl implements CheLanguagesTestAPI { ); } - $provideRenameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: CancellationToken): PromiseLike { + $provideRenameEdits(pluginID: string, resource: Uri, position: Position, newName: string, token: CancellationToken): PromiseLike { return this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'renameEdits').then(({ languagesExt, handle }) => languagesExt.$provideRenameEdits(handle, resource, position, newName, token) ); } - async $provideDocumentSymbols(pluginID: string, resource: UriComponents, token: CancellationToken): Promise { + async $provideDocumentSymbols(pluginID: string, resource: Uri, token: CancellationToken): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'symbols'); return languagesExt.$provideDocumentSymbols(handle, resource, token); } diff --git a/extensions/eclipse-che-theia-plugin-ext/src/common/che-languages-test-protocol.ts b/extensions/eclipse-che-theia-plugin-ext/src/common/che-languages-test-protocol.ts index 8e1c70da3..b42557fe0 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/common/che-languages-test-protocol.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/common/che-languages-test-protocol.ts @@ -28,8 +28,7 @@ import { CodeAction, FoldingRange, } from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; -import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; -import { CancellationToken, FoldingContext } from '@theia/plugin'; +import { CancellationToken, FoldingContext, Uri } from '@theia/plugin'; import { SymbolInformation } from 'vscode-languageserver-types'; import { Position, @@ -40,47 +39,47 @@ import { // Expose additional API that allows you to know if a language server is connected and build a map of the language servers export interface CheLanguagesTestAPI { - $provideCompletionItems(pluginID: string, resource: UriComponents, position: Position, + $provideCompletionItems(pluginID: string, resource: Uri, position: Position, context: CompletionContext, token: CancellationToken): Promise; - $provideImplementation(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - $provideTypeDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - $provideDefinition(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - $provideDeclaration(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - $provideReferences(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: CancellationToken): Promise; + $provideImplementation(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; + $provideTypeDefinition(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; + $provideDefinition(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; + $provideDeclaration(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; + $provideReferences(pluginID: string, resource: Uri, position: Position, context: ReferenceContext, token: CancellationToken): Promise; $provideSignatureHelp( - pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: CancellationToken + pluginID: string, resource: Uri, position: Position, context: SignatureHelpContext, token: CancellationToken ): Promise; - $provideHover(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - $provideDocumentHighlights(pluginID: string, resource: UriComponents, position: Position, token: CancellationToken): Promise; - $provideDocumentFormattingEdits(pluginID: string, resource: UriComponents, + $provideHover(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; + $provideDocumentHighlights(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; + $provideDocumentFormattingEdits(pluginID: string, resource: Uri, options: FormattingOptions, token: CancellationToken): Promise; - $provideDocumentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, + $provideDocumentRangeFormattingEdits(pluginID: string, resource: Uri, range: Range, options: FormattingOptions, token: CancellationToken): Promise; $provideOnTypeFormattingEdits( pluginID: string, - resource: UriComponents, + resource: Uri, position: Position, ch: string, options: FormattingOptions, token: CancellationToken ): Promise; - $provideDocumentLinks(pluginID: string, resource: UriComponents, token: CancellationToken): Promise; - $provideCodeLenses(pluginID: string, resource: UriComponents, token: CancellationToken): Promise; + $provideDocumentLinks(pluginID: string, resource: Uri, token: CancellationToken): Promise; + $provideCodeLenses(pluginID: string, resource: Uri, token: CancellationToken): Promise; $provideCodeActions( pluginID: string, - resource: UriComponents, + resource: Uri, rangeOrSelection: Range | Selection, context: CodeActionContext, token: CancellationToken ): Promise; - $provideDocumentSymbols(pluginID: string, resource: UriComponents, token: CancellationToken): Promise; + $provideDocumentSymbols(pluginID: string, resource: Uri, token: CancellationToken): Promise; $provideWorkspaceSymbols(pluginID: string, query: string, token: CancellationToken): PromiseLike; $provideFoldingRange( pluginID: string, - resource: UriComponents, + resource: Uri, context: FoldingContext, token: CancellationToken ): PromiseLike; - $provideDocumentColors(pluginID: string, resource: UriComponents, token: CancellationToken): PromiseLike; - $provideRenameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: CancellationToken): PromiseLike; + $provideDocumentColors(pluginID: string, resource: Uri, token: CancellationToken): PromiseLike; + $provideRenameEdits(pluginID: string, resource: Uri, position: Position, newName: string, token: CancellationToken): PromiseLike; } diff --git a/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts b/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts index 0ce2f8200..75050aeea 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts @@ -49,7 +49,6 @@ import { CodeAction, FoldingRange, } from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; -import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; import { SymbolInformation } from 'vscode-languageserver-types'; import { Position, @@ -261,47 +260,47 @@ export function createAPIFactory(rpc: RPCProtocol): CheApiFactory { const languagesTest: typeof che.languages.test = { - completion(pluginID: string, resource: UriComponents, position: Position, + completion(pluginID: string, resource: theia.Uri, position: Position, context: CompletionContext, token: theia.CancellationToken): Promise { return languageTestAPI.$provideCompletionItems(pluginID, resource, position, context, token); }, - implementation(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise { + implementation(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise { return languageTestAPI.$provideImplementation(pluginID, resource, position, token); }, - typeDefinition(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise { + typeDefinition(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise { return languageTestAPI.$provideTypeDefinition(pluginID, resource, position, token); }, - definition(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise { + definition(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise { return languageTestAPI.$provideDefinition(pluginID, resource, position, token); }, - declaration(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise { + declaration(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise { return languageTestAPI.$provideDeclaration(pluginID, resource, position, token); }, - references(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: theia.CancellationToken): Promise { + references(pluginID: string, resource: theia.Uri, position: Position, context: ReferenceContext, token: theia.CancellationToken): Promise { return languageTestAPI.$provideReferences(pluginID, resource, position, context, token); }, signatureHelp( - pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: theia.CancellationToken + pluginID: string, resource: theia.Uri, position: Position, context: SignatureHelpContext, token: theia.CancellationToken ): Promise { return languageTestAPI.$provideSignatureHelp(pluginID, resource, position, context, token); }, - hover(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise { + hover(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise { return languageTestAPI.$provideHover(pluginID, resource, position, token); }, - documentHighlights(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise { + documentHighlights(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise { return languageTestAPI.$provideDocumentHighlights(pluginID, resource, position, token); }, - documentFormattingEdits(pluginID: string, resource: UriComponents, + documentFormattingEdits(pluginID: string, resource: theia.Uri, options: FormattingOptions, token: theia.CancellationToken): Promise { return languageTestAPI.$provideDocumentFormattingEdits(pluginID, resource, options, token); }, - documentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, + documentRangeFormattingEdits(pluginID: string, resource: theia.Uri, range: Range, options: FormattingOptions, token: theia.CancellationToken): Promise { return languageTestAPI.$provideDocumentRangeFormattingEdits(pluginID, resource, range, options, token); }, onTypeFormattingEdits( pluginID: string, - resource: UriComponents, + resource: theia.Uri, position: Position, ch: string, options: FormattingOptions, @@ -309,22 +308,22 @@ export function createAPIFactory(rpc: RPCProtocol): CheApiFactory { ): Promise { return languageTestAPI.$provideOnTypeFormattingEdits(pluginID, resource, position, ch, options, token); }, - documentLinks(pluginID: string, resource: UriComponents, token: theia.CancellationToken): Promise { + documentLinks(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): Promise { return languageTestAPI.$provideDocumentLinks(pluginID, resource, token); }, - codeLenses(pluginID: string, resource: UriComponents, token: theia.CancellationToken): Promise { + codeLenses(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): Promise { return languageTestAPI.$provideCodeLenses(pluginID, resource, token); }, codeActions( pluginID: string, - resource: UriComponents, + resource: theia.Uri, rangeOrSelection: Range | Selection, context: CodeActionContext, token: theia.CancellationToken ): Promise { return languageTestAPI.$provideCodeActions(pluginID, resource, rangeOrSelection, context, token); }, - documentSymbols(pluginID: string, resource: UriComponents, token: theia.CancellationToken): Promise { + documentSymbols(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): Promise { return languageTestAPI.$provideDocumentSymbols(pluginID, resource, token); }, workspaceSymbols(pluginID: string, query: string, token: theia.CancellationToken): PromiseLike { @@ -332,16 +331,16 @@ export function createAPIFactory(rpc: RPCProtocol): CheApiFactory { }, foldingRange( pluginID: string, - resource: UriComponents, + resource: theia.Uri, context: theia.FoldingContext, token: theia.CancellationToken ): PromiseLike { return languageTestAPI.$provideFoldingRange(pluginID, resource, context, token); }, - documentColors(pluginID: string, resource: UriComponents, token: theia.CancellationToken): PromiseLike { + documentColors(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): PromiseLike { return languageTestAPI.$provideDocumentColors(pluginID, resource, token); }, - renameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: theia.CancellationToken): PromiseLike { + renameEdits(pluginID: string, resource: theia.Uri, position: Position, newName: string, token: theia.CancellationToken): PromiseLike { return languageTestAPI.$provideRenameEdits(pluginID, resource, position, newName, token); } }; diff --git a/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts b/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts index b609543b5..f209b4b22 100644 --- a/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts +++ b/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts @@ -35,7 +35,6 @@ import { CodeAction, FoldingRange, } from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; -import { UriComponents } from '@theia/plugin-ext/lib/common/uri-components'; import { SymbolInformation } from 'vscode-languageserver-types'; import { Position, @@ -331,49 +330,49 @@ declare module '@eclipse-che/plugin' { export namespace languages { export namespace test { - export function completion(pluginID: string, resource: UriComponents, position: Position, + export function completion(pluginID: string, resource: theia.Uri, position: Position, context: CompletionContext, token: theia.CancellationToken): Promise; - export function implementation(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise; - export function typeDefinition(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise; - export function definition(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise; - export function declaration(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise; - export function references(pluginID: string, resource: UriComponents, position: Position, context: ReferenceContext, token: theia.CancellationToken): Promise; + export function implementation(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise; + export function typeDefinition(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise; + export function definition(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise; + export function declaration(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise; + export function references(pluginID: string, resource: theia.Uri, position: Position, context: ReferenceContext, token: theia.CancellationToken): Promise; export function signatureHelp( - pluginID: string, resource: UriComponents, position: Position, context: SignatureHelpContext, token: theia.CancellationToken + pluginID: string, resource: theia.Uri, position: Position, context: SignatureHelpContext, token: theia.CancellationToken ): Promise; - export function hover(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise; - export function documentHighlights(pluginID: string, resource: UriComponents, position: Position, token: theia.CancellationToken): Promise; - export function documentFormattingEdits(pluginID: string, resource: UriComponents, + export function hover(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise; + export function documentHighlights(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise; + export function documentFormattingEdits(pluginID: string, resource: theia.Uri, options: FormattingOptions, token: theia.CancellationToken): Promise; - export function documentRangeFormattingEdits(pluginID: string, resource: UriComponents, range: Range, + export function documentRangeFormattingEdits(pluginID: string, resource: theia.Uri, range: Range, options: FormattingOptions, token: theia.CancellationToken): Promise; export function onTypeFormattingEdits( pluginID: string, - resource: UriComponents, + resource: theia.Uri, position: Position, ch: string, options: FormattingOptions, token: theia.CancellationToken ): Promise; - export function documentLinks(pluginID: string, resource: UriComponents, token: theia.CancellationToken): Promise; - export function codeLenses(pluginID: string, resource: UriComponents, token: theia.CancellationToken): Promise; + export function documentLinks(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): Promise; + export function codeLenses(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): Promise; export function codeActions( pluginID: string, - resource: UriComponents, + resource: theia.Uri, rangeOrSelection: Range | Selection, context: CodeActionContext, token: theia.CancellationToken ): Promise; - export function documentSymbols(pluginID: string, resource: UriComponents, token: theia.CancellationToken): Promise; + export function documentSymbols(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): Promise; export function workspaceSymbols(pluginID: string, query: string, token: theia.CancellationToken): PromiseLike; export function foldingRange( pluginID: string, - resource: UriComponents, + resource: theia.Uri, context: theia.FoldingContext, token: theia.CancellationToken ): PromiseLike; - export function documentColors(pluginID: string, resource: UriComponents, token: theia.CancellationToken): PromiseLike; - export function renameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: theia.CancellationToken): PromiseLike; + export function documentColors(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): PromiseLike; + export function renameEdits(pluginID: string, resource: theia.Uri, position: Position, newName: string, token: theia.CancellationToken): PromiseLike; } } From f40aeb682c230fffb1bfd69fae90b6e6b0327828 Mon Sep 17 00:00:00 2001 From: svor Date: Thu, 20 Aug 2020 11:29:46 +0300 Subject: [PATCH 10/12] Update language test api to use types from theia/plugin Signed-off-by: svor --- .../src/browser/che-languages-test-api.ts | 386 ++++++++++++++---- .../src/browser/type-converters.ts | 378 +++++++++++++++++ .../src/common/che-languages-test-protocol.ts | 93 +++-- .../src/plugin/che-api.ts | 162 +++++--- .../src/che-proposed.d.ts | 163 +++++--- 5 files changed, 960 insertions(+), 222 deletions(-) create mode 100644 extensions/eclipse-che-theia-plugin-ext/src/browser/type-converters.ts diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts index a736dd148..8ec925b62 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts @@ -12,33 +12,35 @@ import { ChePluginHandleRegistry } from './che-plugin-handle-registry'; import { interfaces } from 'inversify'; import { CheLanguagesTestAPI } from '../common/che-languages-test-protocol'; import { + CancellationToken, + FoldingContext, + CodeActionContext, + Uri, + CompletionList, + SignatureHelpContext, + ReferenceContext, CompletionContext, - CompletionResultDto, - SignatureHelp, - Hover, - DocumentHighlight, - Range, - TextEdit, FormattingOptions, - Definition, - DocumentLink, - CodeLensSymbol, - DocumentSymbol, - ReferenceContext, - Location, - SignatureHelpContext, - CodeActionContext, CodeAction, - FoldingRange, -} from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; -import { CancellationToken, FoldingContext, Uri } from '@theia/plugin'; -import { SymbolInformation } from 'vscode-languageserver-types'; -import { + Range, + DocumentHighlight, + DocumentSymbol, + DocumentLink, + Definition, + TextEdit, + DefinitionLink, + CodeLens, + Hover, Position, Selection, - RawColorInfo, - WorkspaceEditDto -} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; + SymbolInformation, + FoldingRange, + ColorInformation, + WorkspaceEdit, + SignatureHelp, + Location +} from '@theia/plugin'; +import * as Converter from './type-converters'; /** * This class redirects language api requests to the correct sidecars and returns the results @@ -51,67 +53,213 @@ export class CheLanguagesTestAPIImpl implements CheLanguagesTestAPI { this.pluginHandleRegistry = container.get(ChePluginHandleRegistry); } - async $provideCompletionItems(pluginID: string, resource: Uri, position: Position, - context: CompletionContext, token: CancellationToken): Promise { + async $provideCompletionItems( + pluginID: string, + resource: Uri, + position: Position, + context: CompletionContext, + token: CancellationToken + ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'completion'); - return languagesExt.$provideCompletionItems(handle, resource, position, context, token); + const convertedPosition = Converter.fromPosition(Converter.revivePosition(position)); + return Promise.resolve(languagesExt.$provideCompletionItems( + handle, + resource, + convertedPosition, + context, + token + )).then(completion => { + if (!completion) { + return undefined; + } else { + return Converter.toCompletionList(completion); + } + }); } - async $provideDefinition(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise { + async $provideDefinition( + pluginID: string, + resource: Uri, + position: Position, + token: CancellationToken + ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'definition'); - return languagesExt.$provideDefinition(handle, resource, position, token); + const convertedPosition = Converter.fromPosition(Converter.revivePosition(position)); + return Promise.resolve(languagesExt.$provideDefinition(handle, resource, convertedPosition, token)).then(definition => { + if (!definition) { + return undefined; + } else { + return Converter.toDefinition(definition); + } + }); } - async $provideDeclaration(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise { - const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'declaration'); - return languagesExt.$provideDeclaration(handle, resource, position, token); + async $provideDeclaration( + pluginID: string, + resource: Uri, + position: Position, + token: CancellationToken + ): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'definition'); + const convertedPosition = Converter.fromPosition(Converter.revivePosition(position)); + return Promise.resolve(languagesExt.$provideDefinition(handle, resource, convertedPosition, token)).then(definition => { + if (!definition) { + return undefined; + } else { + return Converter.toDefinition(definition); + } + }); } - async $provideSignatureHelp(pluginID: string, resource: Uri, position: Position, context: SignatureHelpContext, token: CancellationToken + async $provideSignatureHelp( + pluginID: string, + resource: Uri, + position: Position, + context: SignatureHelpContext, + token: CancellationToken ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'signatureHelp'); - return languagesExt.$provideSignatureHelp(handle, resource, position, context, token); + const convertedPosition = Converter.fromPosition(Converter.revivePosition(position)); + return Promise.resolve(languagesExt.$provideSignatureHelp(handle, resource, convertedPosition, context, token)).then(signatureHelp => { + if (!signatureHelp) { + return undefined; + } else { + return Converter.toSignatureHelp(signatureHelp); + } + }); } - async $provideImplementation(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise { + async $provideImplementation( + pluginID: string, + resource: Uri, + position: Position, + token: CancellationToken + ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'implementation'); - return languagesExt.$provideImplementation(handle, resource, position, token); + const convertedPosition = Converter.fromPosition(Converter.revivePosition(position)); + return Promise.resolve(languagesExt.$provideImplementation(handle, resource, convertedPosition, token)).then(implementation => { + if (!implementation) { + return undefined; + } else { + return Converter.toDefinition(implementation); + } + }); } - async $provideTypeDefinition(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise { + async $provideTypeDefinition( + pluginID: string, + resource: Uri, + position: Position, + token: CancellationToken + ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'typeDefinition'); - return languagesExt.$provideTypeDefinition(handle, resource, position, token); + const convertedPosition = Converter.fromPosition(Converter.revivePosition(position)); + return Promise.resolve(languagesExt.$provideTypeDefinition(handle, resource, convertedPosition, token)).then(typeDefinition => { + if (!typeDefinition) { + return undefined; + } else { + return Converter.toDefinition(typeDefinition); + } + }); } - async $provideHover(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise { + async $provideHover( + pluginID: string, + resource: Uri, + position: Position, + token: CancellationToken + ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'hover'); - return languagesExt.$provideHover(handle, resource, position, token); + const convertedPosition = Converter.fromPosition(Converter.revivePosition(position)); + return Promise.resolve(languagesExt.$provideHover(handle, resource, convertedPosition, token)).then(hover => { + if (!hover) { + return undefined; + } else { + return Converter.toHover(hover); + } + }); } - async $provideDocumentHighlights(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise { + async $provideDocumentHighlights( + pluginID: string, + resource: Uri, + position: Position, + token: CancellationToken + ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentHighlight'); - return languagesExt.$provideDocumentHighlights(handle, resource, position, token); + const convertedPosition = Converter.fromPosition(Converter.revivePosition(position)); + return Promise.resolve(languagesExt.$provideDocumentHighlights(handle, resource, convertedPosition, token)).then(highlights => { + if (!highlights) { + return undefined; + } else { + return highlights.map(Converter.toDocumentHighlight); + } + }); } - $provideWorkspaceSymbols(pluginID: string, query: string, token: CancellationToken): PromiseLike { - return this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'workspaceSymbols').then(({ languagesExt, handle }) => - languagesExt.$provideWorkspaceSymbols(handle, query, token) - ); + async $provideWorkspaceSymbols( + pluginID: string, + query: string, + token: CancellationToken + ): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'workspaceSymbols'); + return Promise.resolve(languagesExt.$provideWorkspaceSymbols(handle, query, token)).then(workspaceSymbols => { + if (!workspaceSymbols) { + return []; + } else { + const newSymbols: SymbolInformation[] = []; + for (const sym of workspaceSymbols) { + const convertedSymbol = Converter.toSymbolInformation(sym); + if (convertedSymbol) { + newSymbols.push(convertedSymbol); + } + }; + return newSymbols; + } + }); } - async $provideDocumentFormattingEdits(pluginID: string, resource: Uri, - options: FormattingOptions, token: CancellationToken): Promise { + async $provideDocumentFormattingEdits( + pluginID: string, + resource: Uri, + options: FormattingOptions, + token: CancellationToken + ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentFormattingEdits'); - return languagesExt.$provideDocumentFormattingEdits(handle, resource, options, token); + return Promise.resolve(languagesExt.$provideDocumentFormattingEdits(handle, resource, options, token)).then(edits => { + if (!edits) { + return undefined; + } else { + return edits.map(Converter.toTextEdit); + } + }); } - async $provideDocumentRangeFormattingEdits(pluginID: string, resource: Uri, range: Range, - options: FormattingOptions, token: CancellationToken): Promise { + async $provideDocumentRangeFormattingEdits( + pluginID: string, + resource: Uri, + range: Range, + options: FormattingOptions, + token: CancellationToken + ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentRangeFormattingEdits'); - return languagesExt.$provideDocumentRangeFormattingEdits(handle, resource, range, options, token); + const convertedRange = Converter.fromRange(Converter.reviveRange(range)); + return Promise.resolve(languagesExt.$provideDocumentRangeFormattingEdits( + handle, + resource, + convertedRange, + options, token + )).then(edits => { + if (!edits) { + return undefined; + } else { + return edits.map(Converter.toTextEdit); + } + }); } - async $provideOnTypeFormattingEdits(pluginID: string, + async $provideOnTypeFormattingEdits( + pluginID: string, resource: Uri, position: Position, ch: string, @@ -119,58 +267,146 @@ export class CheLanguagesTestAPIImpl implements CheLanguagesTestAPI { token: CancellationToken ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'onTypeFormattingEdits'); - return languagesExt.$provideOnTypeFormattingEdits(handle, resource, position, ch, options, token); + const convertedPosition = Converter.fromPosition(Converter.revivePosition(position)); + return Promise.resolve(languagesExt.$provideOnTypeFormattingEdits(handle, resource, convertedPosition, ch, options, token)).then(edits => { + if (!edits) { + return undefined; + } else { + return edits.map(Converter.toTextEdit); + } + }); } - async $provideDocumentLinks(pluginID: string, resource: Uri, token: CancellationToken): Promise { + async $provideDocumentLinks( + pluginID: string, + resource: Uri, + token: CancellationToken + ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentLinks'); - return languagesExt.$provideDocumentLinks(handle, resource, token); + return Promise.resolve(languagesExt.$provideDocumentLinks(handle, resource, token)).then(links => { + if (!links) { + return undefined; + } else { + return links.map(Converter.toDocumentLink); + } + }); } - async $provideCodeActions(pluginID: string, + async $provideCodeActions( + pluginID: string, resource: Uri, rangeOrSelection: Range | Selection, context: CodeActionContext, token: CancellationToken ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'codeActions'); - return languagesExt.$provideCodeActions(handle, resource, rangeOrSelection, context, token); + const rangeOrSelectionParam = rangeOrSelection.hasOwnProperty('_anchor') && rangeOrSelection.hasOwnProperty('_active') ? + Converter.fromSelection(Converter.reviveSelection(rangeOrSelection)) : + Converter.fromRange(Converter.reviveRange(rangeOrSelection)); + return Promise.resolve(languagesExt.$provideCodeActions( + handle, + resource, + rangeOrSelectionParam, + Converter.fromCodeActionContext(context), + token + )).then(actions => { + if (!actions) { + return undefined; + } else { + return actions.map(Converter.toCodeAction); + } + }); } - async $provideCodeLenses(pluginID: string, resource: Uri, token: CancellationToken): Promise { + async $provideCodeLenses( + pluginID: string, + resource: Uri, + token: CancellationToken + ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'codeLenses'); - return languagesExt.$provideCodeLenses(handle, resource, token); + return Promise.resolve(languagesExt.$provideCodeLenses(handle, resource, token)).then(lenses => { + if (!lenses) { + return undefined; + } else { + return lenses.map(Converter.toCodeLens); + } + }); } - async $provideReferences(pluginID: string, resource: Uri, position: Position, context: ReferenceContext, token: CancellationToken): Promise { + async $provideReferences( + pluginID: string, + resource: Uri, + position: Position, + context: ReferenceContext, + token: CancellationToken + ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'references'); - return languagesExt.$provideReferences(handle, resource, position, context, token); + const convertedPosition = Converter.fromPosition(Converter.revivePosition(position)); + return Promise.resolve(languagesExt.$provideReferences(handle, resource, convertedPosition, context, token)).then(locations => { + if (!locations) { + return undefined; + } else { + return locations.map(Converter.toLocation); + } + }); } - $provideDocumentColors(pluginID: string, resource: Uri, token: CancellationToken): PromiseLike { - return this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentColors').then(({ languagesExt, handle }) => - languagesExt.$provideDocumentColors(handle, resource, token) - ); + async $provideDocumentColors( + pluginID: string, + resource: Uri, + token: CancellationToken + ): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'documentColors'); + return Promise.resolve(languagesExt.$provideDocumentColors(handle, resource, token)) + .then(rawColorInfo => rawColorInfo.map(Converter.toColorInformation)); } - $provideFoldingRange(pluginID: string, + async $provideFoldingRange( + pluginID: string, resource: Uri, context: FoldingContext, token: CancellationToken - ): PromiseLike { - return this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'foldingRange').then(({ languagesExt, handle }) => - languagesExt.$provideFoldingRange(handle, resource, context, token) - ); + ): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'foldingRange'); + return Promise.resolve(languagesExt.$provideFoldingRange(handle, resource, context, token)).then(foldingRanges => { + if (!foldingRanges) { + return undefined; + } else { + return foldingRanges.map(Converter.toFoldingRange); + } + }); } - $provideRenameEdits(pluginID: string, resource: Uri, position: Position, newName: string, token: CancellationToken): PromiseLike { - return this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'renameEdits').then(({ languagesExt, handle }) => - languagesExt.$provideRenameEdits(handle, resource, position, newName, token) - ); + async $provideRenameEdits( + pluginID: string, + resource: Uri, + position: Position, + newName: string, + token: CancellationToken + ): Promise { + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'renameEdits'); + const convertedPosition = Converter.fromPosition(Converter.revivePosition(position)); + return Promise.resolve(languagesExt.$provideRenameEdits(handle, resource, convertedPosition, newName, token)).then(edits => { + if (!edits) { + return undefined; + } else { + return Converter.toWorkspaceEdit(edits); + } + }); } - async $provideDocumentSymbols(pluginID: string, resource: Uri, token: CancellationToken): Promise { + async $provideDocumentSymbols( + pluginID: string, + resource: Uri, + token: CancellationToken + ): Promise { const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'symbols'); - return languagesExt.$provideDocumentSymbols(handle, resource, token); + return Promise.resolve(languagesExt.$provideDocumentSymbols(handle, resource, token)).then(documentSymbols => { + if (!documentSymbols) { + return undefined; + } else { + return documentSymbols.map(Converter.toDocumentSymbol); + } + }); } } diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/type-converters.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/type-converters.ts new file mode 100644 index 000000000..e19e8b179 --- /dev/null +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/type-converters.ts @@ -0,0 +1,378 @@ +/********************************************************************* + * Copyright (c) 2020 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import * as model from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; +import { SymbolInformation } from 'vscode-languageserver-types'; +import * as theia from '@theia/plugin'; +import * as types from '@theia/plugin-ext/lib/plugin/types-impl'; +import * as Converter from '@theia/plugin-ext/lib/plugin/type-converters'; +import { URI } from 'vscode-uri'; +import { + Selection, Position, RawColorInfo, ResourceFileEditDto, + ResourceTextEditDto +} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; + +export function toWorkspaceEdit(workspaceEdit: model.WorkspaceEdit): theia.WorkspaceEdit { + const result: theia.WorkspaceEdit = new types.WorkspaceEdit(); + console.log(result); + + const edits = workspaceEdit.edits; + for (const entry of edits) { + if (entry.hasOwnProperty('oldUri')) { + const fileEdit = entry as ResourceFileEditDto; + + result.renameFile(URI.revive(fileEdit.oldUri), URI.revive(fileEdit.newUri), fileEdit.options); + } else { + const textEdit = entry as ResourceTextEditDto; + result.set(URI.revive(textEdit.resource), textEdit.edits.map(toTextEdit)); + } + } + return result; +} + +export function toCompletionList(completionResultDTO: model.CompletionResultDto): theia.CompletionList { + const result: theia.CompletionList = { + items: [] + }; + if (completionResultDTO.hasOwnProperty('incomplete')) { + result.isIncomplete = completionResultDTO.incomplete; + } + result.items = completionResultDTO.completions.map(toCompletionItem); + return result; +} + +export function toCompletionItem(completionDTO: model.CompletionDto): theia.CompletionItem { + let range: theia.CompletionItem['range'] | undefined; + const itemRange = completionDTO.range; + if (!itemRange) { + range = undefined; + } else if (itemRange.hasOwnProperty('insert') && itemRange.hasOwnProperty('replace')) { + const inserting = Converter.toRange((itemRange as unknown as { + insert: model.Range; + replace: model.Range; + }).insert); + const replacing = Converter.toRange((itemRange as unknown as { + insert: model.Range; + replace: model.Range; + }).replace); + range = { + inserting: inserting, + replacing: replacing + }; + } else { + range = Converter.toRange(itemRange as model.Range); + } + + return { + label: completionDTO.label, + range: range, + additionalTextEdits: completionDTO.additionalTextEdits && completionDTO.additionalTextEdits.map(toTextEdit), + command: toCommand(completionDTO.command), + commitCharacters: completionDTO.commitCharacters, + detail: completionDTO.detail, + filterText: completionDTO.filterText, + insertText: completionDTO.insertText, + keepWhitespace: completionDTO.insertTextRules ? true : false, + kind: Converter.toCompletionItemKind(completionDTO.kind), + preselect: completionDTO.preselect, + sortText: completionDTO.sortText, + }; +} + +export function toHover(hover: model.Hover): theia.Hover { + let range = undefined; + if (hover.range) { + range = Converter.toRange(hover.range); + } + const markdown = hover.contents.map(Converter.toMarkdown); + return { + range: range, + contents: markdown + }; +} + +export function toFoldingRange(foldingRange: model.FoldingRange): theia.FoldingRange { + const range: theia.FoldingRange = { + start: foldingRange.start - 1, + end: foldingRange.end - 1 + }; + if (foldingRange.kind) { + range.kind = toFoldingRangeKind(foldingRange.kind); + } + return range; +} + +export function toDocumentLink(link: model.DocumentLink): theia.DocumentLink { + let target = undefined; + if (link.url) { + try { + target = typeof link.url === 'string' ? URI.parse(link.url, true) : URI.revive(link.url); + } catch (err) { + // ignore + } + } + return { + range: Converter.toRange(link.range), + target: target + }; +} + +export function toFoldingRangeKind(kind: model.FoldingRangeKind | undefined): theia.FoldingRangeKind | undefined { + if (kind) { + switch (kind) { + case model.FoldingRangeKind.Comment: + return types.FoldingRangeKind.Comment; + case model.FoldingRangeKind.Imports: + return types.FoldingRangeKind.Imports; + case model.FoldingRangeKind.Region: + return types.FoldingRangeKind.Region; + } + } + return undefined; +} + +export function toCodeLens(lenses: model.CodeLensSymbol): theia.CodeLens { + return { + range: Converter.toRange(lenses.range), + command: lenses.command, + isResolved: true + }; +} + +export function toDefinition(definition: model.Definition): theia.Definition | theia.DefinitionLink[] | undefined { + if (isLocationLinkArray(definition)) { + const definitionLinks: theia.DefinitionLink[] = []; + for (const location of definition) { + definitionLinks.push(toDefinitionLink(location)); + } + return definitionLinks; + } else if (isLocationArray(definition)) { + const locations: theia.Location[] = []; + for (const location of definition) { + locations.push(Converter.toLocation(location)); + } + return locations; + } else { + return Converter.toLocation(definition); + } +} + +export function toDefinitionLink(locationLink: model.LocationLink): theia.DefinitionLink { + return { + targetUri: Converter.toLocation(locationLink as model.Location).uri, + targetRange: Converter.toRange(locationLink.range), + originSelectionRange: locationLink.originSelectionRange ? Converter.toRange(locationLink.originSelectionRange) : undefined, + targetSelectionRange: locationLink.targetSelectionRange ? Converter.toRange(locationLink.targetSelectionRange) : undefined + }; +} + +export function toTextEdit(edit: model.TextEdit): theia.TextEdit { + return { + newText: edit.text, + range: Converter.toRange(edit.range), + newEol: edit.eol === 1 ? 2 : 1 + }; +} + +export function toSignatureHelp(signatureHelp: model.SignatureHelp): theia.SignatureHelp { + return Converter.SignatureHelp.to(signatureHelp); +} + +export function toDocumentSymbol(symbol: model.DocumentSymbol): theia.DocumentSymbol { + return Converter.toDocumentSymbol(symbol); +} + +export function toSymbolInformation(symbolInformation: SymbolInformation): theia.SymbolInformation | undefined { + return Converter.toSymbolInformation(symbolInformation); +} + +export function toLocation(location: model.Location): theia.Location { + return Converter.toLocation(location); +} + +export function toDocumentHighlight(documentHighlight: model.DocumentHighlight): theia.DocumentHighlight { + return { + range: Converter.toRange(documentHighlight.range), + kind: toDocumentHighlightKind(documentHighlight.kind) + }; +} + +export function toDocumentHighlightKind(kind: model.DocumentHighlightKind | undefined): types.DocumentHighlightKind { + switch (kind) { + case model.DocumentHighlightKind.Text: return types.DocumentHighlightKind.Text; + case model.DocumentHighlightKind.Read: return types.DocumentHighlightKind.Read; + case model.DocumentHighlightKind.Write: return types.DocumentHighlightKind.Write; + }; + return types.DocumentHighlightKind.Text; +} + +export function toCodeAction(action: model.CodeAction): theia.CodeAction { + return { + title: action.title, + command: toCommand(action.command), + diagnostics: toDiagnostics(action.diagnostics), + kind: action.kind ? new types.CodeActionKind(action.kind) : undefined, + edit: action.edit ? toWorkspaceEdit(action.edit) : undefined + }; +} + +export function toCommand(command: model.Command | undefined): theia.Command | undefined { + if (!command) { + return undefined; + } + return { + id: command.id, + title: command.title, + arguments: command.arguments, + tooltip: command.tooltip + }; +} + +export function toDiagnostics(diagnostics: model.MarkerData[] | undefined): theia.Diagnostic[] | undefined { + return diagnostics ? diagnostics.map(toDiagnostic) : undefined; +} + +export function fromRange(range: theia.Range): model.Range { + return Converter.fromRange(range); +} + +export function fromPosition(position: theia.Position): Position { + return { lineNumber: position.line + 1, column: position.character + 1 }; +} + +export function toColorInformation(rawColorInfo: RawColorInfo): theia.ColorInformation { + return { + color: Converter.toColor(rawColorInfo.color), + range: Converter.toRange(rawColorInfo.range) + }; +} + +export function fromCodeActionContext(context: theia.CodeActionContext): model.CodeActionContext { + return { + only: context.only?.value + }; +} + +export function fromSelection(selection: theia.Selection): Selection { + const { active, anchor } = selection; + return { + selectionStartLineNumber: anchor.line + 1, + selectionStartColumn: anchor.character + 1, + positionLineNumber: active.line + 1, + positionColumn: active.character + 1 + }; +} + +export function toDiagnostic(marker: model.MarkerData): theia.Diagnostic { + return { + message: marker.message, + range: Converter.toRange({ + startLineNumber: marker.startLineNumber, + startColumn: marker.startColumn, + endLineNumber: marker.endLineNumber, + endColumn: marker.endColumn + }), + severity: toDiagnosticSeverity(marker.severity), + code: marker.code, + source: marker.source, + relatedInformation: toDiagnosticRelatedInformation(marker.relatedInformation), + tags: toDiagnosticTags(marker.tags) + }; +} + +export function toDiagnosticSeverity(severity: types.MarkerSeverity): types.DiagnosticSeverity { + switch (severity) { + case types.MarkerSeverity.Error: return types.DiagnosticSeverity.Error; + case types.MarkerSeverity.Warning: return types.DiagnosticSeverity.Warning; + case types.MarkerSeverity.Info: return types.DiagnosticSeverity.Information; + case types.MarkerSeverity.Hint: return types.DiagnosticSeverity.Hint; + }; +} + +export function toDiagnosticRelatedInformation(relatedInformation: model.RelatedInformation[] | undefined): theia.DiagnosticRelatedInformation[] | undefined { + if (!relatedInformation) { + return undefined; + } + const diagnosticRelatedInformation: theia.DiagnosticRelatedInformation[] = []; + for (const item of relatedInformation) { + const location: theia.Location = { + uri: URI.parse(item.resource), + range: Converter.toRange({ + startLineNumber: item.startLineNumber, + startColumn: item.startColumn, + endLineNumber: item.endLineNumber, + endColumn: item.endColumn + }) + }; + diagnosticRelatedInformation.push({ + location: location, + message: item.message + }); + } + return diagnosticRelatedInformation; +} + +function toDiagnosticTags(tags: types.MarkerTag[] | undefined): types.DiagnosticTag[] | undefined { + if (!tags) { + return undefined; + } + + const diagnosticTags: theia.DiagnosticTag[] = []; + for (const tag of tags) { + if (tag === types.MarkerTag.Unnecessary) { + diagnosticTags.push(types.DiagnosticTag.Unnecessary); + } + } + return diagnosticTags; +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function isLocationArray(array: any): array is model.Location[] { + return Array.isArray(array) && array.length > 0; +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function isLocationLinkArray(array: any): array is model.LocationLink[] { + return Array.isArray(array) && array.length > 0 && array[0].hasOwnProperty('originSelectionRange') && array[0].hasOwnProperty('targetSelectionRange'); +} + +// Try to restore Position object from its serialized content +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function revivePosition(position: any): theia.Position { + if (!position || !position._line || !position._character) { + throw new Error('Not able to restore position'); + } + const result: theia.Position = new types.Position(position._line, position._character); + return result; +} + +// Try to restore Range object from its serialized content +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function reviveRange(range: any): theia.Range { + if (!range || !range._start || !range._end) { + throw new Error('Not able to restore range'); + } + const start = revivePosition(range._start); + const end = revivePosition(range._end); + const result: theia.Range = new types.Range(start.line, start.character, end.line, end.character); + return result; +} + +// Try to restore Selection object from its serialized content +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function reviveSelection(selection: any): theia.Selection { + if (!selection || !selection._anchor || !selection._active) { + throw new Error('Not able to restore selection'); + } + const anchor = revivePosition(selection._anchor); + const active = revivePosition(selection._active); + const result: theia.Selection = new types.Selection(anchor.line, anchor.character, active.line, active.character); + return result; +} diff --git a/extensions/eclipse-che-theia-plugin-ext/src/common/che-languages-test-protocol.ts b/extensions/eclipse-che-theia-plugin-ext/src/common/che-languages-test-protocol.ts index b42557fe0..a8ad015e9 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/common/che-languages-test-protocol.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/common/che-languages-test-protocol.ts @@ -9,52 +9,71 @@ **********************************************************************/ import { + CancellationToken, + FormattingOptions, + CodeActionContext, CompletionContext, - CompletionResultDto, - SignatureHelp, - Hover, + SignatureHelpContext, + FoldingContext, + ReferenceContext, + Uri, + CompletionList, DocumentHighlight, - Range, - TextEdit, - FormattingOptions, - Definition, - DocumentLink, - CodeLensSymbol, + CodeLens, DocumentSymbol, - ReferenceContext, - Location, - SignatureHelpContext, - CodeActionContext, + DocumentLink, + ColorInformation, + TextEdit, + Range, CodeAction, - FoldingRange, -} from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; -import { CancellationToken, FoldingContext, Uri } from '@theia/plugin'; -import { SymbolInformation } from 'vscode-languageserver-types'; -import { + DefinitionLink, + Definition, + Hover, Position, Selection, - RawColorInfo, - WorkspaceEditDto -} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; + SymbolInformation, + FoldingRange, + WorkspaceEdit, + SignatureHelp, + Location +} from '@theia/plugin'; // Expose additional API that allows you to know if a language server is connected and build a map of the language servers export interface CheLanguagesTestAPI { - $provideCompletionItems(pluginID: string, resource: Uri, position: Position, - context: CompletionContext, token: CancellationToken): Promise; - $provideImplementation(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; - $provideTypeDefinition(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; - $provideDefinition(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; - $provideDeclaration(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; + $provideCompletionItems( + pluginID: string, + resource: Uri, + position: Position, + context: CompletionContext, + token: CancellationToken + ): Promise; + $provideImplementation(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; + $provideTypeDefinition(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; + $provideDefinition(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; + $provideDeclaration(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; $provideReferences(pluginID: string, resource: Uri, position: Position, context: ReferenceContext, token: CancellationToken): Promise; $provideSignatureHelp( - pluginID: string, resource: Uri, position: Position, context: SignatureHelpContext, token: CancellationToken + pluginID: string, + resource: Uri, + position: Position, + context: SignatureHelpContext, + token: CancellationToken ): Promise; $provideHover(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; $provideDocumentHighlights(pluginID: string, resource: Uri, position: Position, token: CancellationToken): Promise; - $provideDocumentFormattingEdits(pluginID: string, resource: Uri, - options: FormattingOptions, token: CancellationToken): Promise; - $provideDocumentRangeFormattingEdits(pluginID: string, resource: Uri, range: Range, - options: FormattingOptions, token: CancellationToken): Promise; + $provideDocumentFormattingEdits( + pluginID: string, + resource: Uri, + options: FormattingOptions, + token: CancellationToken + ): Promise; + $provideDocumentRangeFormattingEdits( + pluginID: string, + resource: Uri, + range: Range, + options: FormattingOptions, + token: CancellationToken + ): Promise; $provideOnTypeFormattingEdits( pluginID: string, resource: Uri, @@ -64,7 +83,7 @@ export interface CheLanguagesTestAPI { token: CancellationToken ): Promise; $provideDocumentLinks(pluginID: string, resource: Uri, token: CancellationToken): Promise; - $provideCodeLenses(pluginID: string, resource: Uri, token: CancellationToken): Promise; + $provideCodeLenses(pluginID: string, resource: Uri, token: CancellationToken): Promise; $provideCodeActions( pluginID: string, resource: Uri, @@ -73,13 +92,13 @@ export interface CheLanguagesTestAPI { token: CancellationToken ): Promise; $provideDocumentSymbols(pluginID: string, resource: Uri, token: CancellationToken): Promise; - $provideWorkspaceSymbols(pluginID: string, query: string, token: CancellationToken): PromiseLike; + $provideWorkspaceSymbols(pluginID: string, query: string, token: CancellationToken): Promise; $provideFoldingRange( pluginID: string, resource: Uri, context: FoldingContext, token: CancellationToken - ): PromiseLike; - $provideDocumentColors(pluginID: string, resource: Uri, token: CancellationToken): PromiseLike; - $provideRenameEdits(pluginID: string, resource: Uri, position: Position, newName: string, token: CancellationToken): PromiseLike; + ): Promise; + $provideDocumentColors(pluginID: string, resource: Uri, token: CancellationToken): Promise; + $provideRenameEdits(pluginID: string, resource: Uri, position: Position, newName: string, token: CancellationToken): Promise; } diff --git a/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts b/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts index 75050aeea..d1b598825 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts @@ -29,33 +29,6 @@ import { CheWorkspaceImpl } from './che-workspace'; import { CheOpenshiftImpl } from './che-openshift'; import { CheOauthImpl } from './che-oauth'; import { Disposable } from '@theia/core'; -import { - CompletionContext, - CompletionResultDto, - SignatureHelp, - Hover, - DocumentHighlight, - Range, - TextEdit, - FormattingOptions, - Definition, - DocumentLink, - CodeLensSymbol, - DocumentSymbol, - ReferenceContext, - Location, - SignatureHelpContext, - CodeActionContext, - CodeAction, - FoldingRange, -} from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; -import { SymbolInformation } from 'vscode-languageserver-types'; -import { - Position, - Selection, - RawColorInfo, - WorkspaceEditDto -} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; export interface CheApiFactory { (plugin: Plugin): typeof che; @@ -260,73 +233,142 @@ export function createAPIFactory(rpc: RPCProtocol): CheApiFactory { const languagesTest: typeof che.languages.test = { - completion(pluginID: string, resource: theia.Uri, position: Position, - context: CompletionContext, token: theia.CancellationToken): Promise { + completion( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + context: theia.CompletionContext, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideCompletionItems(pluginID, resource, position, context, token); }, - implementation(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise { + implementation( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideImplementation(pluginID, resource, position, token); }, - typeDefinition(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise { + typeDefinition( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideTypeDefinition(pluginID, resource, position, token); }, - definition(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise { + definition( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideDefinition(pluginID, resource, position, token); }, - declaration(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise { + declaration( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideDeclaration(pluginID, resource, position, token); }, - references(pluginID: string, resource: theia.Uri, position: Position, context: ReferenceContext, token: theia.CancellationToken): Promise { + references( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + context: theia.ReferenceContext, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideReferences(pluginID, resource, position, context, token); }, signatureHelp( - pluginID: string, resource: theia.Uri, position: Position, context: SignatureHelpContext, token: theia.CancellationToken - ): Promise { + pluginID: string, + resource: theia.Uri, + position: theia.Position, + context: theia.SignatureHelpContext, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideSignatureHelp(pluginID, resource, position, context, token); }, - hover(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise { + hover(pluginID: string, + resource: theia.Uri, + position: theia.Position, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideHover(pluginID, resource, position, token); }, - documentHighlights(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise { + documentHighlights( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideDocumentHighlights(pluginID, resource, position, token); }, - documentFormattingEdits(pluginID: string, resource: theia.Uri, - options: FormattingOptions, token: theia.CancellationToken): Promise { + documentFormattingEdits( + pluginID: string, + resource: theia.Uri, + options: theia.FormattingOptions, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideDocumentFormattingEdits(pluginID, resource, options, token); }, - documentRangeFormattingEdits(pluginID: string, resource: theia.Uri, range: Range, - options: FormattingOptions, token: theia.CancellationToken): Promise { + documentRangeFormattingEdits( + pluginID: string, + resource: theia.Uri, + range: theia.Range, + options: theia.FormattingOptions, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideDocumentRangeFormattingEdits(pluginID, resource, range, options, token); }, onTypeFormattingEdits( pluginID: string, resource: theia.Uri, - position: Position, + position: theia.Position, ch: string, - options: FormattingOptions, + options: theia.FormattingOptions, token: theia.CancellationToken - ): Promise { + ): Promise { return languageTestAPI.$provideOnTypeFormattingEdits(pluginID, resource, position, ch, options, token); }, - documentLinks(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): Promise { + documentLinks( + pluginID: string, + resource: theia.Uri, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideDocumentLinks(pluginID, resource, token); }, - codeLenses(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): Promise { + codeLenses( + pluginID: string, + resource: theia.Uri, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideCodeLenses(pluginID, resource, token); }, codeActions( pluginID: string, resource: theia.Uri, - rangeOrSelection: Range | Selection, - context: CodeActionContext, + rangeOrSelection: theia.Range | theia.Selection, + context: theia.CodeActionContext, token: theia.CancellationToken - ): Promise { + ): Promise { return languageTestAPI.$provideCodeActions(pluginID, resource, rangeOrSelection, context, token); }, - documentSymbols(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): Promise { + documentSymbols( + pluginID: string, + resource: theia.Uri, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideDocumentSymbols(pluginID, resource, token); }, - workspaceSymbols(pluginID: string, query: string, token: theia.CancellationToken): PromiseLike { + workspaceSymbols( + pluginID: string, + query: string, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideWorkspaceSymbols(pluginID, query, token); }, foldingRange( @@ -334,13 +376,23 @@ export function createAPIFactory(rpc: RPCProtocol): CheApiFactory { resource: theia.Uri, context: theia.FoldingContext, token: theia.CancellationToken - ): PromiseLike { + ): Promise { return languageTestAPI.$provideFoldingRange(pluginID, resource, context, token); }, - documentColors(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): PromiseLike { + documentColors( + pluginID: string, + resource: theia.Uri, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideDocumentColors(pluginID, resource, token); }, - renameEdits(pluginID: string, resource: theia.Uri, position: Position, newName: string, token: theia.CancellationToken): PromiseLike { + renameEdits( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + newName: string, + token: theia.CancellationToken + ): Promise { return languageTestAPI.$provideRenameEdits(pluginID, resource, position, newName, token); } }; diff --git a/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts b/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts index f209b4b22..9b2926c95 100644 --- a/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts +++ b/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts @@ -15,33 +15,6 @@ import { che as cheApi } from '@eclipse-che/api' import * as theia from '@theia/plugin'; -import { - CompletionContext, - CompletionResultDto, - SignatureHelp, - Hover, - DocumentHighlight, - Range, - TextEdit, - FormattingOptions, - Definition, - DocumentLink, - CodeLensSymbol, - DocumentSymbol, - ReferenceContext, - Location, - SignatureHelpContext, - CodeActionContext, - CodeAction, - FoldingRange, -} from '@theia/plugin-ext/lib/common/plugin-api-rpc-model'; -import { SymbolInformation } from 'vscode-languageserver-types'; -import { - Position, - Selection, - RawColorInfo, - WorkspaceEditDto -} from '@theia/plugin-ext/lib/common/plugin-api-rpc'; declare module '@eclipse-che/plugin' { @@ -330,49 +303,129 @@ declare module '@eclipse-che/plugin' { export namespace languages { export namespace test { - export function completion(pluginID: string, resource: theia.Uri, position: Position, - context: CompletionContext, token: theia.CancellationToken): Promise; - export function implementation(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise; - export function typeDefinition(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise; - export function definition(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise; - export function declaration(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise; - export function references(pluginID: string, resource: theia.Uri, position: Position, context: ReferenceContext, token: theia.CancellationToken): Promise; + export function completion( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + context: theia.CompletionContext, + token: theia.CancellationToken + ): Promise; + export function implementation( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + token: theia.CancellationToken + ): Promise; + export function typeDefinition( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + token: theia.CancellationToken + ): Promise; + export function definition( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + token: theia.CancellationToken + ): Promise; + export function declaration( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + token: theia.CancellationToken + ): Promise; + export function references( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + context: theia.ReferenceContext, + token: theia.CancellationToken + ): Promise; export function signatureHelp( - pluginID: string, resource: theia.Uri, position: Position, context: SignatureHelpContext, token: theia.CancellationToken - ): Promise; - export function hover(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise; - export function documentHighlights(pluginID: string, resource: theia.Uri, position: Position, token: theia.CancellationToken): Promise; - export function documentFormattingEdits(pluginID: string, resource: theia.Uri, - options: FormattingOptions, token: theia.CancellationToken): Promise; - export function documentRangeFormattingEdits(pluginID: string, resource: theia.Uri, range: Range, - options: FormattingOptions, token: theia.CancellationToken): Promise; + pluginID: string, + resource: theia.Uri, + position: theia.Position, + context: theia.SignatureHelpContext, + token: theia.CancellationToken + ): Promise; + export function hover( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + token: theia.CancellationToken + ): Promise; + export function documentHighlights( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + token: theia.CancellationToken + ): Promise; + export function documentFormattingEdits( + pluginID: string, + resource: theia.Uri, + options: theia.FormattingOptions, + token: theia.CancellationToken + ): Promise; + export function documentRangeFormattingEdits( + pluginID: string, + resource: theia.Uri, + range: theia.Range, + options: theia.FormattingOptions, + token: theia.CancellationToken + ): Promise; export function onTypeFormattingEdits( pluginID: string, resource: theia.Uri, - position: Position, + position: theia.Position, ch: string, - options: FormattingOptions, + options: theia.FormattingOptions, + token: theia.CancellationToken + ): Promise; + export function documentLinks( + pluginID: string, + resource: theia.Uri, token: theia.CancellationToken - ): Promise; - export function documentLinks(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): Promise; - export function codeLenses(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): Promise; + ): Promise; + export function codeLenses( + pluginID: string, + resource: theia.Uri, + token: theia.CancellationToken + ): Promise; export function codeActions( pluginID: string, resource: theia.Uri, - rangeOrSelection: Range | Selection, - context: CodeActionContext, + rangeOrSelection: theia.Range | theia.Selection, + context: theia.CodeActionContext, + token: theia.CancellationToken + ): Promise; + export function documentSymbols( + pluginID: string, + resource: theia.Uri, token: theia.CancellationToken - ): Promise; - export function documentSymbols(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): Promise; - export function workspaceSymbols(pluginID: string, query: string, token: theia.CancellationToken): PromiseLike; + ): Promise; + export function workspaceSymbols( + pluginID: string, + query: string, + token: theia.CancellationToken + ): Promise; export function foldingRange( pluginID: string, resource: theia.Uri, context: theia.FoldingContext, token: theia.CancellationToken - ): PromiseLike; - export function documentColors(pluginID: string, resource: theia.Uri, token: theia.CancellationToken): PromiseLike; - export function renameEdits(pluginID: string, resource: theia.Uri, position: Position, newName: string, token: theia.CancellationToken): PromiseLike; + ): Promise; + export function documentColors( + pluginID: string, + resource: theia.Uri, + token: theia.CancellationToken + ): Promise; + export function renameEdits( + pluginID: string, + resource: theia.Uri, + position: theia.Position, + newName: string, + token: theia.CancellationToken + ): Promise; } } From 7b62137466c3d38b19a2c7ccd9159255798bf941 Mon Sep 17 00:00:00 2001 From: svor Date: Fri, 21 Aug 2020 15:42:12 +0300 Subject: [PATCH 11/12] Fix declaration request Signed-off-by: svor --- .../src/browser/che-languages-test-api.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts index 8ec925b62..cd592bdb8 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-languages-test-api.ts @@ -100,13 +100,13 @@ export class CheLanguagesTestAPIImpl implements CheLanguagesTestAPI { position: Position, token: CancellationToken ): Promise { - const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'definition'); + const { languagesExt, handle } = await this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'declaration'); const convertedPosition = Converter.fromPosition(Converter.revivePosition(position)); - return Promise.resolve(languagesExt.$provideDefinition(handle, resource, convertedPosition, token)).then(definition => { - if (!definition) { + return Promise.resolve(languagesExt.$provideDeclaration(handle, resource, convertedPosition, token)).then(declaration => { + if (!declaration) { return undefined; } else { - return Converter.toDefinition(definition); + return Converter.toDefinition(declaration); } }); } From a636459b3b12ab3bab59e4008002fb0c796648c7 Mon Sep 17 00:00:00 2001 From: svor Date: Tue, 8 Sep 2020 11:16:57 +0300 Subject: [PATCH 12/12] code cleanup Signed-off-by: svor --- .../src/browser/type-converters.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/type-converters.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/type-converters.ts index e19e8b179..a5dfcfe7e 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/browser/type-converters.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/type-converters.ts @@ -21,9 +21,8 @@ import { export function toWorkspaceEdit(workspaceEdit: model.WorkspaceEdit): theia.WorkspaceEdit { const result: theia.WorkspaceEdit = new types.WorkspaceEdit(); - console.log(result); - const edits = workspaceEdit.edits; + for (const entry of edits) { if (entry.hasOwnProperty('oldUri')) { const fileEdit = entry as ResourceFileEditDto; @@ -115,7 +114,7 @@ export function toDocumentLink(link: model.DocumentLink): theia.DocumentLink { try { target = typeof link.url === 'string' ? URI.parse(link.url, true) : URI.revive(link.url); } catch (err) { - // ignore + console.error(err); } } return {