[@types/vscode] Error: Cannot find module 'vscode' #69423
Unanswered
eiboon
asked this question in
Issues with a @types package
Replies: 1 comment
-
Thanks for the discussion about "vscode", some useful links for everyone: Pinging the DT module owners: @microsoft. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I really need some help as I cannot find or understand why this is not working. I am writing an LSP for a currently unsupported languange for vscode. I am at the part for semantic highlighting. From all the examples it needs
npm i @types/vscode
and to then import, I have te basic code below, which shows and compiles fine. When I go to run it, the LSP is failing stating it cannot find the vscode module. full code is available https://github.com/eiboon/4680.import {
SemanticTokensLegend,
DocumentSemanticTokensProvider,
TextDocument,
ProviderResult,
SemanticTokens,
SemanticTokensBuilder,
Range,
Position,
languages
} from 'vscode';
`const tokenTypes = ['class', 'interface', 'enum', 'function', 'variable'];` `const tokenModifiers = ['declaration', 'documentation'];` `export const legend = new SemanticTokensLegend(tokenTypes, tokenModifiers);`
const semanticProvider: DocumentSemanticTokensProvider = {
provideDocumentSemanticTokens(
document: TextDocument
): ProviderResult<SemanticTokens> {
const tokensBuilder = new SemanticTokensBuilder(legend);
tokensBuilder.push(
new Range(new Position(1, 1), new Position(1, 5)), 'class', ['declaration']
);
return tokensBuilder.build();
}
};
const selector = { language: 'java', scheme: 'file' }; // register for all Java documents from the local file system
export function RegisterSemanticToken(): void {
languages.registerDocumentSemanticTokensProvider(selector, semanticProvider, legend);
}
Beta Was this translation helpful? Give feedback.
All reactions