Skip to content
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

Adjust builtin scheme #255

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions hugo/content/docs/recipes/builtin-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,15 @@ 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 (`src/extension/main.ts`). The document selector used for your language should handle the `builtin` scheme.

```ts
// Options to control the language client
clientOptions: LanguageClientOptions = {
documentSelector: [{ language: 'mydsl' }],
// Alternatively:
documentSelector: [{ scheme: '*', language: 'mydsl' }],
documentSelector: [
{ scheme: 'file', language: 'mydsl' },
{ scheme: 'builtin', language: 'mydsl' }
],
}
```
**Warning:** It is discouraged to set `scheme` to `'*'`, as, for example, we do not want to build a Git revision when performing a Git diff.
Loading