Skip to content
Merged
Show file tree
Hide file tree
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: 9 additions & 1 deletion packages/tailwindcss-language-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -990,22 +990,30 @@ async function createProjectService(
if (!state.enabled) return null
let document = documentService.getDocument(params.textDocument.uri)
if (!document) return null
let settings = await state.editor.getConfiguration(document.uri)
if (!settings.tailwindCSS.hovers) return null
if (await isExcluded(state, document)) return null
return doHover(state, document, params.position)
},
async onCompletion(params: CompletionParams): Promise<CompletionList> {
if (!state.enabled) return null
let document = documentService.getDocument(params.textDocument.uri)
if (!document) return null
let settings = await state.editor.getConfiguration(document.uri)
if (!settings.tailwindCSS.suggestions) return null
if (await isExcluded(state, document)) return null
return doComplete(state, document, params.position, params.context)
},
onCompletionResolve(item: CompletionItem): Promise<CompletionItem> {
if (!state.enabled) return null
return resolveCompletionItem(state, item)
},
onCodeAction(params: CodeActionParams): Promise<CodeAction[]> {
async onCodeAction(params: CodeActionParams): Promise<CodeAction[]> {
if (!state.enabled) return null
let document = documentService.getDocument(params.textDocument.uri)
if (!document) return null
let settings = await state.editor.getConfiguration(document.uri)
if (!settings.tailwindCSS.codeActions) return null
return doCodeActions(state, params)
},
provideDiagnostics: debounce((document: TextDocument) => {
Expand Down
3 changes: 3 additions & 0 deletions packages/tailwindcss-language-service/src/util/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export type Settings = {
emmetCompletions: boolean
includeLanguages: Record<string, string>
classAttributes: string[]
suggestions: boolean
hovers: boolean
codeActions: boolean
validate: boolean
showPixelEquivalents: boolean
rootFontSize: number
Expand Down
12 changes: 12 additions & 0 deletions packages/vscode-tailwindcss/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ Show `px` equivalents for `rem` CSS values in completions and hovers. **Default:

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

### `tailwindCSS.hovers`

Enable hovers. **Default: `true`**

### `tailwindCSS.suggestions`

Enable autocomplete suggestions. **Default: `true`**

### `tailwindCSS.codeActions`

Enable code actions. **Default: `true`**

### `tailwindCSS.validate`

Enable linting. Rules can be configured individually using the `tailwindcss.lint` settings:
Expand Down
18 changes: 18 additions & 0 deletions packages/vscode-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,24 @@
],
"markdownDescription": "The HTML attributes for which to provide class completions, hover previews, linting etc."
},
"tailwindCSS.suggestions": {
"type": "boolean",
"default": true,
"markdownDescription": "Enable autocomplete suggestions.",
"scope": "language-overridable"
},
"tailwindCSS.hovers": {
"type": "boolean",
"default": true,
"markdownDescription": "Enable hovers.",
"scope": "language-overridable"
},
"tailwindCSS.codeActions": {
"type": "boolean",
"default": true,
"markdownDescription": "Enable code actions.",
"scope": "language-overridable"
},
"tailwindCSS.colorDecorators": {
"type": "boolean",
"default": true,
Expand Down