Skip to content

Commit

Permalink
Update builtin-library.md
Browse files Browse the repository at this point in the history
Add explanation on how to configure the documentSelector when using builtin libraries
  • Loading branch information
ydaveluy authored Aug 30, 2024
1 parent 4dfaa9b commit 3268740
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions hugo/content/docs/recipes/builtin-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -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' }],
}
```

0 comments on commit 3268740

Please sign in to comment.