Skip to content

Commit

Permalink
(fix) remove some options (sveltejs#1520)
Browse files Browse the repository at this point in the history
These options don't make sense to be toggleable, because the user has to perform an explicit action to use them, and because we can't hide/disable the corresponding menu entries/shortcuts if the user choses to disable them
  • Loading branch information
dummdidumm committed Jun 14, 2022
1 parent bc93baf commit caf179a
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 129 deletions.
20 changes: 0 additions & 20 deletions packages/language-server/README.md
Expand Up @@ -119,14 +119,6 @@ Enable document symbols for TypeScript. _Default_: `true`

Enable completions for TypeScript. _Default_: `true`

##### `svelte.plugin.typescript.findReferences.enable`

Enable find-references for TypeScript. _Default_: `true`

##### `svelte.plugin.typescript.definitions.enable`

Enable go to definition for TypeScript. _Default_: `true`

##### `svelte.plugin.typescript.codeActions.enable`

Enable code actions for TypeScript. _Default_: `true`
Expand All @@ -135,10 +127,6 @@ Enable code actions for TypeScript. _Default_: `true`

Enable selection range for TypeScript. _Default_: `true`

##### `svelte.plugin.typescript.rename.enable`

Enable rename functionality for JS/TS variables inside Svelte files. _Default_: `true`

##### `svelte.plugin.typescript.signatureHelp.enable`

Enable signature help (parameter hints) for JS/TS. _Default_: `true`
Expand All @@ -147,10 +135,6 @@ Enable signature help (parameter hints) for JS/TS. _Default_: `true`

Enable semantic tokens (semantic highlight) for TypeScript. _Default_: `true`

##### `svelte.plugin.typescript.implementation.enable`

Enable go to implementation for Typescript. _Default_: `true`

##### `svelte.plugin.css.enable`

Enable the CSS plugin. _Default_: `true`
Expand Down Expand Up @@ -221,10 +205,6 @@ Enable document symbols for HTML. _Default_: `true`

Enable Linked Editing for HTML. _Default_: `true`

##### `svelte.plugin.html.renameTags.enable`

Enable rename tags for the opening/closing tag pairs in HTML. _Default_: `true`

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

Enable the Svelte plugin. _Default_: `true`
Expand Down
34 changes: 1 addition & 33 deletions packages/language-server/src/ls-config.ts
Expand Up @@ -12,18 +12,11 @@ const defaultLSConfig: LSConfig = {
diagnostics: { enable: true },
hover: { enable: true },
completions: { enable: true },
definitions: { enable: true },
findReferences: { enable: true },
fileReferences: { enable: true },
findComponentReferences: { enable: true },
documentSymbols: { enable: true },
codeActions: { enable: true },
rename: { enable: true },
selectionRange: { enable: true },
signatureHelp: { enable: true },
semanticTokens: { enable: true },
implementation: { enable: true },
typeDefinition: { enable: true }
semanticTokens: { enable: true }
},
css: {
enable: true,
Expand All @@ -42,7 +35,6 @@ const defaultLSConfig: LSConfig = {
completions: { enable: true, emmet: true },
tagComplete: { enable: true },
documentSymbols: { enable: true },
renameTags: { enable: true },
linkedEditing: { enable: true }
},
svelte: {
Expand Down Expand Up @@ -96,24 +88,9 @@ export interface LSTypescriptConfig {
completions: {
enable: boolean;
};
findReferences: {
enable: boolean;
};
fileReferences: {
enable: boolean;
};
findComponentReferences: {
enable: boolean;
};
definitions: {
enable: boolean;
};
codeActions: {
enable: boolean;
};
rename: {
enable: boolean;
};
selectionRange: {
enable: boolean;
};
Expand All @@ -123,12 +100,6 @@ export interface LSTypescriptConfig {
semanticTokens: {
enable: boolean;
};
implementation: {
enable: boolean;
};
typeDefinition: {
enable: boolean;
};
}

export interface LSCSSConfig {
Expand Down Expand Up @@ -173,9 +144,6 @@ export interface LSHTMLConfig {
documentSymbols: {
enable: boolean;
};
renameTags: {
enable: boolean;
};
linkedEditing: {
enable: boolean;
};
Expand Down
8 changes: 0 additions & 8 deletions packages/language-server/src/plugins/html/HTMLPlugin.ts
Expand Up @@ -234,10 +234,6 @@ export class HTMLPlugin
}

rename(document: Document, position: Position, newName: string): WorkspaceEdit | null {
if (!this.featureEnabled('renameTags')) {
return null;
}

const html = this.documents.get(document);
if (!html) {
return null;
Expand All @@ -252,10 +248,6 @@ export class HTMLPlugin
}

prepareRename(document: Document, position: Position): Range | null {
if (!this.featureEnabled('renameTags')) {
return null;
}

const html = this.documents.get(document);
if (!html) {
return null;
Expand Down
Expand Up @@ -329,10 +329,6 @@ export class TypeScriptPlugin
}

async getDefinitions(document: Document, position: Position): Promise<DefinitionLink[]> {
if (!this.featureEnabled('definitions')) {
return [];
}

const { lang, tsDoc } = await this.getLSAndTSDoc(document);
const mainFragment = tsDoc.getFragment();

Expand Down Expand Up @@ -369,10 +365,6 @@ export class TypeScriptPlugin
}

async prepareRename(document: Document, position: Position): Promise<Range | null> {
if (!this.featureEnabled('rename')) {
return null;
}

return this.renameProvider.prepareRename(document, position);
}

Expand All @@ -381,10 +373,6 @@ export class TypeScriptPlugin
position: Position,
newName: string
): Promise<WorkspaceEdit | null> {
if (!this.featureEnabled('rename')) {
return null;
}

return this.renameProvider.rename(document, position, newName);
}

Expand Down Expand Up @@ -431,26 +419,14 @@ export class TypeScriptPlugin
position: Position,
context: ReferenceContext
): Promise<Location[] | null> {
if (!this.featureEnabled('findReferences')) {
return null;
}

return this.findReferencesProvider.findReferences(document, position, context);
}

async fileReferences(uri: string): Promise<Location[] | null> {
if (!this.featureEnabled('fileReferences')) {
return null;
}

return this.findFileReferencesProvider.fileReferences(uri);
}

async findComponentReferences(uri: string): Promise<Location[] | null> {
if (!this.featureEnabled('findComponentReferences')) {
return null;
}

return this.findComponentReferencesProvider.findComponentReferences(uri);
}

Expand Down Expand Up @@ -536,18 +512,10 @@ export class TypeScriptPlugin
}

async getImplementation(document: Document, position: Position): Promise<Location[] | null> {
if (!this.featureEnabled('implementation')) {
return null;
}

return this.implementationProvider.getImplementation(document, position);
}

async getTypeDefinition(document: Document, position: Position): Promise<Location[] | null> {
if (!this.featureEnabled('typeDefinition')) {
return null;
}

return this.typeDefinitionProvider.getTypeDefinition(document, position);
}

Expand Down
36 changes: 0 additions & 36 deletions packages/svelte-vscode/package.json
Expand Up @@ -132,18 +132,6 @@
"title": "TypeScript: Completions",
"description": "Enable completions for TypeScript"
},
"svelte.plugin.typescript.findReferences.enable": {
"type": "boolean",
"default": true,
"title": "TypeScript: Find References",
"description": "Enable find-references for TypeScript"
},
"svelte.plugin.typescript.definitions.enable": {
"type": "boolean",
"default": true,
"title": "TypeScript: Go to Definition",
"description": "Enable go to definition for TypeScript"
},
"svelte.plugin.typescript.codeActions.enable": {
"type": "boolean",
"default": true,
Expand All @@ -162,30 +150,12 @@
"title": "TypeScript: Signature Help",
"description": "Enable signature help (parameter hints) for TypeScript"
},
"svelte.plugin.typescript.rename.enable": {
"type": "boolean",
"default": true,
"title": "TypeScript: Rename",
"description": "Enable rename functionality for JS/TS variables inside Svelte files"
},
"svelte.plugin.typescript.semanticTokens.enable": {
"type": "boolean",
"default": true,
"title": "TypeScript: Semantic Tokens",
"description": "Enable semantic tokens (semantic highlight) for TypeScript."
},
"svelte.plugin.typescript.implementation.enable": {
"type": "boolean",
"default": true,
"title": "Typescript: Go to Implementation",
"description": "Enable go to implementation for Typescript"
},
"svelte.plugin.typescript.typeDefinition.enable": {
"type": "boolean",
"default": true,
"title": "Typescript: Go to Type Definition",
"description": "Enable go to Type Definition for Typescript"
},
"svelte.plugin.css.enable": {
"type": "boolean",
"default": true,
Expand Down Expand Up @@ -288,12 +258,6 @@
"title": "HTML: Linked Editing",
"description": "Enable Linked Editing for HTML"
},
"svelte.plugin.html.renameTags.enable": {
"type": "boolean",
"default": true,
"title": "HTML: Rename tags",
"description": "Enable rename for the opening/closing tag pairs in HTML"
},
"svelte.plugin.svelte.enable": {
"type": "boolean",
"default": true,
Expand Down

0 comments on commit caf179a

Please sign in to comment.