-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Language service use of a whole notebook as single (concat) document #100186
Comments
The
The snippet below does that for the definition provider. A request for a notebook cell is translated into a request for the concat document. Then const cellSelector = { language: 'css', scheme: 'vscode-notebook-cell', exclusive: true };
vscode.languages.registerDefinitionProvider(cellSelector, new class implements vscode.DefinitionProvider {
async provideDefinition(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken) {
if (!notebook.cells.find(cell => cell.uri.toString() === document.uri.toString())) {
console.log('NOPE')
return;
}
const pos = concatDoc.positionAt(new vscode.Location(document.uri, position)); // translate: cell -> concat
const result = await vscode.commands.executeCommand<vscode.Location[]>('vscode.executeDefinitionProvider', concatDoc.uri, pos);
return result && result.map(loc => concatDoc.locationAt(loc.range)); // translate: concat -> cell
}
});
|
Closing as the "a concat doc is a normal doc" approach didn't work so well (see above). We will add a language service guide for notebooks |
Develop an end-to-end sample that maps many cells to a single LS document, e.g have single concat document for a notebook that re-uses TypeScript features and/or features from a language service (LSP)
The text was updated successfully, but these errors were encountered: