-
Notifications
You must be signed in to change notification settings - Fork 111
Implementation of testing api for testing vscode extensions language features #597
Conversation
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/common/test-protocol.ts
Outdated
Show resolved
Hide resolved
One thing that is not clear to me is how tests are loaded and run. |
1827a48
to
7b13bd5
Compare
I originally experimented with having the test loader as a che theia plugin but over time it felt like it made more sense to go with the strategy where each plugin will load the tests themselves. This allows the tests to have a certain level of configurability, such as how long the tests should try to run before timing out, and gives the additional benefit of not having to lock into using specific testing frameworks. I've done some documentation on how the tests will work in https://github.com/jpinkney/che-java-tests#running-these-tests-automatically-when-a-workspace-starts but the basic idea is that you first start a workspace using a devfile that references a theia testing plugin (like https://github.com/jpinkney/che-java-tests). When the workspace starts the testing plugin loads in all the tests and communicates with the testing-api that is available in this PR |
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-main.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/plugin-handle-registry.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service/src/testing-service.d.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/node/testservice-ext-backend-module.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/plugin/testservice-api.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/testservice-plugin-api-provider.ts
Outdated
Show resolved
Hide resolved
7b13bd5
to
8377c63
Compare
68ecaa7
to
e39d362
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello
will look more deeply
I think there are some missings compilation.tsconfig.json
for new folders ?
I was wondering why we need another root namespace for the test-service ? '@eclipse-che/testing-service
and not included it in @eclipse-che/plugin
under a test namespace
@benoitf I can move it to under the |
I'm +1 for keeping everything under a single |
I think it makes perfect sense to have a separate API namespace: the che namespace essentially deals with communicating with the WSMaster API: workspace, devfiles, etc. The testing namespace has no substantial connection with that topic. |
sorry Thomas, but for all the reasons you're referring I'm even more for included in che namespace is what you have when using che instead of theia, its not for only using workspace API. (it's just that it's evolving on the needs)
I don't see where it would make it impossible, you can link namespace. And what if people already starts to use Also I'm talking about
Why you would cut that ? If I use VS Code I can run tests on the 'production binary'. As a user I would want to test my plug-in on che.openshift.io for example. |
@benoitf the testing API is not che-specific, there is really no reason to include it in the Che namespace other than pure convenience. If Che is mentioned elsewhere in the PR, we should probably change those occurrences. We even thought about doing all the works upstream, but decided on doing it downstream because it's simpler to proceed with the task. |
Could you explain what you mean by this? I don't understand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As always, I have t couple of nitpicks, but otherwise I like this PR.
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/languages-test-api.ts
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/plugin-handle-registry.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/plugin-handle-registry.ts
Outdated
Show resolved
Hide resolved
extensions/eclipse-che-theia-testing-service-ext/src/browser/plugin-handle-registry.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
e39d362
to
d992ae8
Compare
Can one of the admins verify this patch? |
lgtm! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please merge test service into @eclipse-che/plugin
into test
namespace or language.test
|
||
declare module '@eclipse-che/testing-service' { | ||
|
||
export namespace languageserver { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these methods should be well documented, this is what the user will see when using code completion on the namespace
export function renameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: CancellationToken): PromiseLike<WorkspaceEditDto | undefined>; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, are you following some rules to have sometimes Promise
vs PromiseLike
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I this case, it should reflect what ever the "non-testing" version of the function uses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok b/c I see in "non-testing"
provideRenameEdits(document: TextDocument, position: Position, newName: string, token: CancellationToken): ProviderResult<WorkspaceEdit>
provideDocumentSymbols(document: TextDocument, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;
and renameEdits
is using PromiseLike while documentSymbols
is using Promise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Types are different because when I was creating the d.ts file I used the types that came out of https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/common/plugin-api-rpc.ts#L1146 not the types that came out of the theia.d.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I see that but we should map to external/public stuff, not implementation, no ?
token: CancellationToken | ||
): PromiseLike<FoldingRange[] | undefined>; | ||
export function documentColors(pluginID: string, resource: UriComponents, token: CancellationToken): PromiseLike<RawColorInfo[]>; | ||
export function renameEdits(pluginID: string, resource: UriComponents, position: Position, newName: string, token: CancellationToken): PromiseLike<WorkspaceEditDto | undefined>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have WorkspaceEditDto
and not WorkspaceEdit
?
Lots of types should come from @theia/plugin
no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/languages.ts#L543 it's just following what provideRenameEdits uses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO it should follow the declaration, not the implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's following the LanguageExt interface: https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/common/plugin-api-rpc.ts#L1196
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
import * as vst from 'vscode-languageserver-types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is used that import ?
@JPinkney and I discussed this in yesterdays daily and we both agree that the testing stuff should be a separate module and API namespace if that's what you object to (for the reasons outlined before). |
} 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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we not using https://github.com/eclipse-theia/theia/blob/master/packages/plugin/src/theia.d.ts#L5448 (I would say all types should come from @theia/plugin
no) ?
@benoitf I've tried switching the types to be compatible with @theia/plugin but I'm not entirely sure if its possible in che-languages-test-api when we call: (languagesExt as LanguagesExt).$provideCompletionItems(......) we are recieving back Promise<CompletionResultDto | undefined> from https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/languages/completion.ts#L39. We aren't actually calling the delegate that has the type theia.CompletionItemProvider https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/languages/completion.ts#L34. Instead, we are getting back the converted result that happens after the delegate is called. When I tried to modify che-languages-test-api to support @thiea/plugin types like $provideImplementation(pluginID: string, document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]> {
return this.pluginHandleRegistry.lookupLanguagesExtForPluginAndAction(pluginID, 'implementation').then(({ languagesExt, handle }) => {
return (languagesExt as LanguagesExt).$provideImplementation(handle, document.uri, { column: position.character, lineNumber: position.line }, token);
});
} it leads to a lot of incompatible types for all of the methods (provideCompletionItems, provideImplementation, etc etc) in that class. It looks like this is because the LanguagesExt interface is using the types from I do have a working branch that has moved the testing api into @eclipse-che/api though. |
Let's please not do that. It's wrong! Before we do that, let's discuss it in a call. |
Superseded by #802 |
What does this PR do?
This PR introduces testing api that allows you to talk to a specific vscode extensions language features. It gives the ability to create tests that call into a vscode language extension for two reasons:
Examples of such tests can be found in: https://github.com/jpinkney/che-java-tests though they're WIP.
What issues does this PR fix or reference?
eclipse-che/che#14409
Release Notes
Docs PR