Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 3d309b0

Browse files
committed
Rename settings, add codeActions setting
1 parent 98488e9 commit 3d309b0

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

packages/tailwindcss-language-server/src/server.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ async function createProjectService(
991991
let document = documentService.getDocument(params.textDocument.uri)
992992
if (!document) return null
993993
let settings = await state.editor.getConfiguration(document.uri)
994-
if (!settings.tailwindCSS.hover) return null
994+
if (!settings.tailwindCSS.hovers) return null
995995
if (await isExcluded(state, document)) return null
996996
return doHover(state, document, params.position)
997997
},
@@ -1000,16 +1000,20 @@ async function createProjectService(
10001000
let document = documentService.getDocument(params.textDocument.uri)
10011001
if (!document) return null
10021002
let settings = await state.editor.getConfiguration(document.uri)
1003-
if (!settings.tailwindCSS.suggest) return null
1003+
if (!settings.tailwindCSS.suggestions) return null
10041004
if (await isExcluded(state, document)) return null
10051005
return doComplete(state, document, params.position, params.context)
10061006
},
10071007
onCompletionResolve(item: CompletionItem): Promise<CompletionItem> {
10081008
if (!state.enabled) return null
10091009
return resolveCompletionItem(state, item)
10101010
},
1011-
onCodeAction(params: CodeActionParams): Promise<CodeAction[]> {
1011+
async onCodeAction(params: CodeActionParams): Promise<CodeAction[]> {
10121012
if (!state.enabled) return null
1013+
let document = documentService.getDocument(params.textDocument.uri)
1014+
if (!document) return null
1015+
let settings = await state.editor.getConfiguration(document.uri)
1016+
if (!settings.tailwindCSS.codeActions) return null
10131017
return doCodeActions(state, params)
10141018
},
10151019
provideDiagnostics: debounce((document: TextDocument) => {

packages/tailwindcss-language-service/src/util/state.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ export type Settings = {
4141
emmetCompletions: boolean
4242
includeLanguages: Record<string, string>
4343
classAttributes: string[]
44-
suggest: boolean
45-
hover: boolean
44+
suggestions: boolean
45+
hovers: boolean
46+
codeActions: boolean
4647
validate: boolean
4748
showPixelEquivalents: boolean
4849
rootFontSize: number

packages/vscode-tailwindcss/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ Show `px` equivalents for `rem` CSS values in completions and hovers. **Default:
9494

9595
Root font size in pixels. Used to convert `rem` CSS values to their `px` equivalents. See [`tailwindCSS.showPixelEquivalents`](#tailwindcssshowpixelequivalents). **Default: `16`**
9696

97+
### `tailwindCSS.hovers`
98+
99+
Enable hovers. **Default: `true`**
100+
101+
### `tailwindCSS.suggestions`
102+
103+
Enable autocomplete suggestions. **Default: `true`**
104+
105+
### `tailwindCSS.codeActions`
106+
107+
Enable code actions. **Default: `true`**
108+
97109
### `tailwindCSS.validate`
98110

99111
Enable linting. Rules can be configured individually using the `tailwindcss.lint` settings:

packages/vscode-tailwindcss/package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,22 @@
160160
],
161161
"markdownDescription": "The HTML attributes for which to provide class completions, hover previews, linting etc."
162162
},
163-
"tailwindCSS.suggest": {
163+
"tailwindCSS.suggestions": {
164164
"type": "boolean",
165165
"default": true,
166166
"markdownDescription": "Enable autocomplete suggestions.",
167167
"scope": "language-overridable"
168168
},
169-
"tailwindCSS.hover": {
169+
"tailwindCSS.hovers": {
170170
"type": "boolean",
171171
"default": true,
172-
"markdownDescription": "Enable hover information.",
172+
"markdownDescription": "Enable hovers.",
173+
"scope": "language-overridable"
174+
},
175+
"tailwindCSS.codeActions": {
176+
"type": "boolean",
177+
"default": true,
178+
"markdownDescription": "Enable code actions.",
173179
"scope": "language-overridable"
174180
},
175181
"tailwindCSS.colorDecorators": {

0 commit comments

Comments
 (0)