From 32687407c33d76d7909318d58c0ad1a964a70dc3 Mon Sep 17 00:00:00 2001 From: Yannick Daveluy Date: Fri, 30 Aug 2024 13:34:11 +0200 Subject: [PATCH 1/2] Update builtin-library.md Add explanation on how to configure the documentSelector when using builtin libraries --- hugo/content/docs/recipes/builtin-library.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hugo/content/docs/recipes/builtin-library.md b/hugo/content/docs/recipes/builtin-library.md index 8401d61e..afd5fd95 100644 --- a/hugo/content/docs/recipes/builtin-library.md +++ b/hugo/content/docs/recipes/builtin-library.md @@ -163,3 +163,18 @@ export function activate(context: vscode.ExtensionContext) { This registers an in-memory file system for vscode to use for the `builtin` file schema. Every time vscode is supposed to open a file with this schema, it will invoke the `stat` and `readFile` methods of the registered file system provider. + +To ensure that LSP services (such as hover, outline, go to definition, etc.) work properly inside a built-in file, make sure that LanguageClientOptions is correctly configured. The document selector used for your language should handle the `builtin` scheme. It is recommended to support all schemes, either by removing the scheme option or by setting the scheme option to '*'. +```ts +// Options to control the language client +clientOptions: LanguageClientOptions = { + documentSelector: [{ language: 'mydsl' }], +} +``` +or +```ts +// Options to control the language client +clientOptions: LanguageClientOptions = { + documentSelector: [{ scheme: '*', language: 'mydsl' }], +} +``` From 37eef2c47560c70a616e72b225a44d7700867331 Mon Sep 17 00:00:00 2001 From: Mark Sujew Date: Wed, 4 Sep 2024 17:33:12 +0200 Subject: [PATCH 2/2] Update builtin-library.md --- hugo/content/docs/recipes/builtin-library.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/hugo/content/docs/recipes/builtin-library.md b/hugo/content/docs/recipes/builtin-library.md index afd5fd95..fcb3e902 100644 --- a/hugo/content/docs/recipes/builtin-library.md +++ b/hugo/content/docs/recipes/builtin-library.md @@ -164,17 +164,13 @@ export function activate(context: vscode.ExtensionContext) { This registers an in-memory file system for vscode to use for the `builtin` file schema. Every time vscode is supposed to open a file with this schema, it will invoke the `stat` and `readFile` methods of the registered file system provider. -To ensure that LSP services (such as hover, outline, go to definition, etc.) work properly inside a built-in file, make sure that LanguageClientOptions is correctly configured. The document selector used for your language should handle the `builtin` scheme. It is recommended to support all schemes, either by removing the scheme option or by setting the scheme option to '*'. +To ensure that LSP services (such as hover, outline, go to definition, etc.) work properly inside a built-in file, make sure that LanguageClientOptions is correctly configured. The document selector used for your language should handle the `builtin` scheme. It is recommended to support all schemes, either by removing the scheme option or by setting the scheme option to `'*'`. + ```ts // Options to control the language client clientOptions: LanguageClientOptions = { documentSelector: [{ language: 'mydsl' }], -} -``` -or -```ts -// Options to control the language client -clientOptions: LanguageClientOptions = { + // Alternatively: documentSelector: [{ scheme: '*', language: 'mydsl' }], } ```