Skip to content

Commit

Permalink
fix: make it possible to disable runes/legacy mode code lens
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm committed Nov 9, 2024
1 parent 7bfe801 commit 5bd4663
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/language-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ Enable code actions for Svelte. _Default_: `true`

Enable selection range for Svelte. _Default_: `true`

##### `svelte.plugin.svelte.runesLegacyModeCodeLens.enable`

Whether or not to show a code lens at the top of Svelte files indicating if they are in runes mode or legacy mode. Only visible in Svelte 5 projects. _Default_: `true`

##### `svelte.plugin.svelte.defaultScriptLanguage`

The default language to use when generating new script tags in Svelte. _Default_: `none`
Expand Down
2 changes: 2 additions & 0 deletions packages/language-server/src/ls-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const defaultLSConfig: LSConfig = {
hover: { enable: true },
codeActions: { enable: true },
selectionRange: { enable: true },
runesLegacyModeCodeLens: { enable: true },
defaultScriptLanguage: 'none'
}
};
Expand Down Expand Up @@ -188,6 +189,7 @@ export interface LSSvelteConfig {
selectionRange: {
enable: boolean;
};
runesLegacyModeCodeLens: { enable: boolean };
defaultScriptLanguage: 'none' | 'ts';
}

Expand Down
2 changes: 2 additions & 0 deletions packages/language-server/src/plugins/svelte/SveltePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export class SveltePlugin
constructor(private configManager: LSConfigManager) {}

async getCodeLens(document: Document): Promise<CodeLens[] | null> {
if (!this.featureEnabled('runesLegacyModeCodeLens')) return null;

const doc = await this.getSvelteDoc(document);
if (!doc.isSvelte5) return null;

Expand Down
6 changes: 6 additions & 0 deletions packages/svelte-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@
"title": "Svelte: Rename",
"description": "Enable rename/move Svelte files functionality"
},
"svelte.plugin.svelte.runesLegacyModeCodeLens.enable": {
"type": "boolean",
"default": true,
"title": "Svelte: Legacy/Runes mode Code Lens",
"description": "Show a code lens at the top of Svelte files indicating if they are in runes mode or legacy mode. Only visible in Svelte 5 projects."
},
"svelte.plugin.svelte.defaultScriptLanguage": {
"type": "string",
"default": "none",
Expand Down

0 comments on commit 5bd4663

Please sign in to comment.