Skip to content

Commit

Permalink
Make sure language specific settings are passed to the language server (
Browse files Browse the repository at this point in the history
#1006)

* Make sure language specific settings are passed to the language server

* Update changelog
  • Loading branch information
thecrypticace authored Jul 2, 2024
1 parent 2c981a3 commit f4b0e54
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/vscode-tailwindcss/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Prerelease

- Fix detection of v3 insiders builds ([#1007](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1007))
- Fix detection of v3 insiders builds ([#1007](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1007))
- Make sure language-specific settings are passed to our language server ([#1006](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1006))

## 0.12.3

Expand Down
18 changes: 17 additions & 1 deletion packages/vscode-tailwindcss/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,23 @@ export async function activate(context: ExtensionContext) {
workspace: {
configuration: (params) => {
return params.items.map(({ section, scopeUri }) => {
let scope: ConfigurationScope | null = scopeUri ? Uri.parse(scopeUri) : null
let scope: ConfigurationScope | null = null

if (scopeUri) {
let uri = Uri.parse(scopeUri)
let doc = Workspace.textDocuments.find((doc) => doc.uri.toString() === scopeUri)

// Make sure we ask VSCode for language specific settings for
// the document as it does not do this automatically
if (doc) {
scope = {
uri,
languageId: doc.languageId,
}
} else {
scope = uri
}
}

let settings = Workspace.getConfiguration(section, scope)

Expand Down

0 comments on commit f4b0e54

Please sign in to comment.