-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop'
- Loading branch information
Showing
349 changed files
with
6,100 additions
and
1,938 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
/.github | ||
/.vscode | ||
/.vscode-test | ||
apps/idl-docs-parser/src/htmls | ||
/dist | ||
/coverage | ||
/idl/test/client-e2e | ||
|
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
137 changes: 137 additions & 0 deletions
137
apps/client-e2e/src/tests/interactions/code-actions/pro-code-code-actions-notebook-2.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,137 @@ | ||
import { GetExtensionPath, Sleep } from '@idl/shared'; | ||
import { GetRealDiagnostic, OpenNotebookInVSCode } from '@idl/vscode/shared'; | ||
import expect from 'expect'; | ||
import * as vscode from 'vscode'; | ||
import { CodeActionParams } from 'vscode-languageserver'; | ||
|
||
import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; | ||
import { RunnerFunction } from '../../runner.interface'; | ||
|
||
/** | ||
* Verifies code actions do the right thing for notebooks | ||
*/ | ||
export const ProCodeCodeActionsNotebook2: RunnerFunction = async (init) => { | ||
/** Open notebooks */ | ||
const nb = await OpenNotebookInVSCode( | ||
GetExtensionPath('idl/test/client-e2e/problems/code-actions-2.idlnb') | ||
); | ||
|
||
/** Get first cell */ | ||
const doc = nb.getCells()[0].document; | ||
|
||
// short pause to make sure we open and parse | ||
await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); | ||
|
||
// get diagnostics | ||
const diags = GetRealDiagnostic(vscode.languages.getDiagnostics(doc.uri)); | ||
|
||
// verify problems | ||
expect(diags.length).toEqual(1); | ||
|
||
/** | ||
* Get URi for the notebook | ||
*/ | ||
const uri = doc.uri.toString(); | ||
|
||
/** | ||
* Event params for LSP user interaction | ||
*/ | ||
const codeActionParams: CodeActionParams = { | ||
textDocument: { | ||
uri, | ||
}, | ||
range: diags[0].range, | ||
context: { | ||
diagnostics: [diags[0]], | ||
}, | ||
}; | ||
|
||
const actions = await init.client.client.sendRequest( | ||
'textDocument/codeAction', | ||
codeActionParams | ||
); | ||
|
||
// verify hover has return | ||
expect(actions).toEqual([ | ||
{ | ||
title: 'Disable "undefined-var" for line', | ||
command: { | ||
command: 'idl.code.fixProblem', | ||
arguments: [ | ||
[ | ||
{ | ||
line: 0, | ||
text: '; idl-disable-next-line undefined-var\nbillboards.thing', | ||
cell: 0, | ||
}, | ||
], | ||
], | ||
title: 'idl.code.fixProblem', | ||
}, | ||
kind: 'refactor.inline', | ||
}, | ||
{ | ||
title: 'Disable "undefined-var" for file or cell', | ||
command: { | ||
command: 'idl.code.fixProblem', | ||
arguments: [ | ||
[ | ||
{ | ||
line: 0, | ||
text: ';+\n; idl-disable undefined-var\n;-\n\nbillboards.thing', | ||
cell: 0, | ||
}, | ||
], | ||
], | ||
title: 'idl.code.fixProblem', | ||
}, | ||
kind: 'refactor.inline', | ||
}, | ||
{ | ||
title: 'Disable "undefined-var" in user settings', | ||
command: { | ||
command: 'idl.code.disableProblemSetting', | ||
arguments: [ | ||
{ | ||
code: 99, | ||
scope: 'user', | ||
}, | ||
], | ||
title: 'idl.code.disableProblemSetting', | ||
}, | ||
kind: '', | ||
}, | ||
{ | ||
title: 'Disable "undefined-var" for workspace', | ||
command: { | ||
command: 'idl.code.disableProblemSetting', | ||
arguments: [ | ||
{ | ||
code: 99, | ||
scope: 'workspace', | ||
}, | ||
], | ||
title: 'idl.code.disableProblemSetting', | ||
}, | ||
kind: '', | ||
}, | ||
{ | ||
title: 'Learn more about "undefined-var"', | ||
command: { | ||
command: 'idl.docs.open', | ||
arguments: ['/problem-codes/codes/99.html'], | ||
title: 'idl.docs.open', | ||
}, | ||
kind: '', | ||
}, | ||
{ | ||
title: 'Learn how to configure reported problems', | ||
command: { | ||
command: 'idl.docs.open', | ||
arguments: ['/problem-codes/configuration.html'], | ||
title: 'idl.docs.open', | ||
}, | ||
kind: '', | ||
}, | ||
]); | ||
}; |
Oops, something went wrong.