-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63dee61
commit 2c41fae
Showing
277 changed files
with
12,887 additions
and
1,240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
apps/client-e2e/src/tests/interactions/idl-json-interact-right.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { GetExtensionPath, Sleep } from '@idl/shared'; | ||
import { | ||
OpenFileInVSCode, | ||
ReplaceDocumentContent, | ||
VSCODE_COMMANDS, | ||
} from '@idl/vscode/shared'; | ||
import expect from 'expect'; | ||
import { readFileSync } from 'fs'; | ||
import * as vscode from 'vscode'; | ||
import { | ||
SemanticTokensParams, | ||
TextDocumentPositionParams, | ||
} from 'vscode-languageserver'; | ||
|
||
import { RunnerFunction } from '../runner.interface'; | ||
|
||
/** | ||
* Verifies idl.json does the right thing with changes and doesnt trigger | ||
* PRO code parsing in the language server | ||
*/ | ||
export const IDLJSONInteractRight: RunnerFunction = async (init) => { | ||
const doc = await OpenFileInVSCode( | ||
GetExtensionPath('idl/test/client-e2e/idl.json') | ||
); | ||
|
||
// short pause to make sure we open and parse | ||
await Sleep(250); | ||
|
||
/** | ||
* Get number of original diagnostics | ||
*/ | ||
const nOrig = vscode.languages.getDiagnostics(doc.uri).length; | ||
|
||
// replace the content in our document | ||
await ReplaceDocumentContent( | ||
doc, | ||
readFileSync( | ||
GetExtensionPath('idl/test/client-e2e/idl-changes.json'), | ||
'utf-8' | ||
) | ||
); | ||
|
||
// short pause | ||
await Sleep(250); | ||
|
||
// verify problems | ||
expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(nOrig); | ||
|
||
/** | ||
* Event params for LSP user interaction | ||
*/ | ||
const params: TextDocumentPositionParams = { | ||
textDocument: { | ||
uri: doc.uri.toString(), | ||
}, | ||
position: { | ||
line: 0, | ||
character: 0, | ||
}, | ||
}; | ||
|
||
/** | ||
* Event params for LSP semantic token request | ||
*/ | ||
const tokenParams: SemanticTokensParams = { | ||
textDocument: { | ||
uri: doc.uri.toString(), | ||
}, | ||
}; | ||
|
||
// send all requests that might trigger parsing | ||
await init.client.client.sendRequest('textDocument/hover', params); | ||
await init.client.client.sendRequest('textDocument/completion', params); | ||
await init.client.client.sendRequest('textDocument/definition', params); | ||
await init.client.client.sendRequest( | ||
'textDocument/semanticTokens/full', | ||
tokenParams | ||
); | ||
|
||
// short pause | ||
await Sleep(250); | ||
|
||
// clear any existing outputs | ||
await vscode.commands.executeCommand(VSCODE_COMMANDS.CLOSE_EDITOR); | ||
}; |
73 changes: 73 additions & 0 deletions
73
apps/client-e2e/src/tests/interactions/notebooks-completion-basic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { GetExtensionPath, Sleep } from '@idl/shared'; | ||
import { OpenNotebookInVSCode, VSCODE_COMMANDS } from '@idl/vscode/shared'; | ||
import expect from 'expect'; | ||
import * as vscode from 'vscode'; | ||
import { | ||
CompletionItem as LanguageServerCompletionItem, | ||
TextDocumentPositionParams, | ||
} from 'vscode-languageserver'; | ||
|
||
import { RunnerFunction } from '../runner.interface'; | ||
|
||
/** | ||
* Verifies working with notebooks does the right thing with changes and doesnt trigger | ||
* PRO code parsing in the language server | ||
*/ | ||
export const NotebookCompletionBasic: RunnerFunction = async (init) => { | ||
const doc = await OpenNotebookInVSCode( | ||
GetExtensionPath('idl/test/client-e2e/notebooks/auto-complete-test.idlnb') | ||
); | ||
|
||
// short pause | ||
await Sleep(250); | ||
|
||
/** | ||
* Event params for LSP user interaction | ||
*/ | ||
const completionParams: TextDocumentPositionParams = { | ||
textDocument: { | ||
uri: doc.cellAt(0).document.uri.toString(), | ||
}, | ||
position: { | ||
line: 0, | ||
character: 7, | ||
}, | ||
}; | ||
|
||
// verify definition has return | ||
const completion1: LanguageServerCompletionItem[] = | ||
await init.client.client.sendRequest( | ||
'textDocument/completion', | ||
completionParams | ||
); | ||
|
||
// verify definition has return | ||
expect(completion1).not.toBeUndefined(); | ||
expect(completion1.length).toEqual(0); | ||
|
||
/** | ||
* Event params for LSP user interaction | ||
*/ | ||
const completionParams2: TextDocumentPositionParams = { | ||
textDocument: { | ||
uri: doc.cellAt(1).document.uri.toString(), | ||
}, | ||
position: { | ||
line: 1, | ||
character: 0, | ||
}, | ||
}; | ||
|
||
const completion2: LanguageServerCompletionItem[] = | ||
await init.client.client.sendRequest( | ||
'textDocument/completion', | ||
completionParams2 | ||
); | ||
|
||
// verify definition has return | ||
expect(completion2).not.toBeUndefined(); | ||
expect(completion2.length).not.toEqual(0); | ||
|
||
// clear any existing outputs | ||
await vscode.commands.executeCommand(VSCODE_COMMANDS.CLOSE_EDITOR); | ||
}; |
Oops, something went wrong.