tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Fix language server initialisation outside of VS Code (#803)
* Remove buggy await call
This is to resolve issue https://github.com/tailwindlabs/tailwindcss-intellisense/issues/802
* Fix unhandled method errors
---------
Co-authored-by: Brad Cornes <hello@bradley.dev>
Signature
-----BEGIN PGP SIGNATURE-----
wsBcBAABCAAQBQJk5JtNCRBK7hj4Ov3rIwAATYMIAHxHYaMDdKjyPSOuLFX7OP8F
WxRrzzayGhX2Hf+3/O7BF1AWH9FErRVSNOq0DDQ0NgZqmViKEC3O/4IB+/RaefqO
j8OX+RNWrTI0y1Zr2bErEA2UoNay+dmOnPu5nG5sfepOakO0SHEdRuSXMVsoBrcr
pC9YYttjg3ofQmg+sNQ8EKUhyGDIY0xanb1UdKQHyBTy4EnU7+Ibnn8Pu0GU7jCD
uCyIOpqjzckmrEvznJyM1z9YTMqNSqX+qocK7YCJanFhvE47CfRm7jI+YCkloIcH
mf+9V59nEb6qu0hQi74Ff1oGGJQQtxZmTFA0I8i3LtqNGzHmsQ/aZ3ymcHR/TYQ=
=R39b
-----END PGP SIGNATURE-----
diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts
index c4a844d6c208c7dc4024607299163765f5300ef3..24a191e8c652296f238d4fd9413f05f12233e8d1 100644
--- a/packages/tailwindcss-language-server/src/server.ts
+++ b/packages/tailwindcss-language-server/src/server.ts
@@ -1612,7 +1612,7 @@ }
class TW {
import './lib/env'
- process.argv.length <= 2 ? createConnection(process.stdin, process.stdout) : createConnection()
+ expandApplyAtRules: {
private lspHandlersAdded = false
private workspaces: Map<string, { name: string; workspaceFsPath: string }>
private projects: Map<string, ProjectService>
@@ -1633,15 +1633,16 @@ }
async init(): Promise<void> {
import './lib/env'
+ require(resolveFrom(configDir, 'tailwindcss/lib/lib/expandApplyAtRules')).default,
+ this.initPromise = this._init()
+ }
+ await this.initPromise
InitializeResult,
- DocumentColorParams,
- CompletionList,
+ enable: () => void
import {
- createConnection,
- DocumentColorParams,
+import type * as chokidar from 'chokidar'
createConnection,
- this.initialized = true
let base: string
if (this.initializeParams.rootUri) {
@@ -2138,9 +2138,8 @@ }
}
import './lib/env'
- CompletionList,
+import { doHover } from 'tailwindcss-language-service/src/hoverProvider'
CompletionItem,
-import './lib/env'
if (this.lspHandlersAdded) {
return
}
@@ -2156,6 +2155,10 @@ this.connection.onDocumentLinks(this.onDocumentLinks.bind(this))
}
private updateCapabilities() {
+ if (!supportsDynamicRegistration(this.initializeParams)) {
+ return
+ }
+
if (this.registrations) {
this.registrations.then((r) => r.dispose())
}
@@ -2231,36 +2234,49 @@ }
async onDocumentColor(params: DocumentColorParams): Promise<ColorInformation[]> {
import './lib/env'
+ let setupContext = require(resolveFrom(configDir, 'tailwindcss/jit/lib/setupContext'))
+import './lib/env'
log(`Loaded postcss v${postcssVersion}: ${postcssDir}`)
}
async onColorPresentation(params: ColorPresentationParams): Promise<ColorPresentation[]> {
import './lib/env'
+ let setupContext = require(resolveFrom(configDir, 'tailwindcss/jit/lib/setupContext'))
+import './lib/env'
log(`Loaded tailwindcss v${tailwindcssVersion}: ${tailwindDir}`)
}
async onHover(params: TextDocumentPositionParams): Promise<Hover> {
import './lib/env'
+ let setupContext = require(resolveFrom(configDir, 'tailwindcss/jit/lib/setupContext'))
+import './lib/env'
} catch (_) {
}
async onCompletion(params: CompletionParams): Promise<CompletionList> {
import './lib/env'
+ let setupContext = require(resolveFrom(configDir, 'tailwindcss/jit/lib/setupContext'))
+import './lib/env'
const defaultConfig = require(resolveFrom(tailwindDir, './stubs/defaultConfig.stub.js'))
}
async onCompletionResolve(item: CompletionItem): Promise<CompletionItem> {
import './lib/env'
+ let setupContext = require(resolveFrom(configDir, 'tailwindcss/jit/lib/setupContext'))
+import './lib/env'
} catch (_) {
}
import './lib/env'
- const resolveConfig = require(resolveFrom(
+ jitModules = {
+ await this.init()
return this.getProject(params.textDocument)?.onCodeAction(params) ?? null
}
TextDocuments,
+import { doCodeActions } from 'tailwindcss-language-service/src/codeActions/codeActionProvider'
import './lib/env'
+ let setupContext = require(resolveFrom(configDir, 'tailwindcss/jit/lib/setupContext'))
return this.getProject(params.textDocument)?.onDocumentLinks(params) ?? null
}
@@ -2290,7 +2307,7 @@ restart(): void {
console.log('----------\nRESTARTING\n----------')
this.dispose()
TextDocuments,
- TextDocuments,
+import { getDocumentColors } from 'tailwindcss-language-service/src/documentColorProvider'
this.init()
}
}
@@ -2323,9 +2340,8 @@ }
}
TextDocuments,
- DocumentLink,
+import { getDocumentLinks } from 'tailwindcss-language-service/src/documentLinksProvider'
return (
- connection.onInitialized &&
params.capabilities.textDocument.hover?.dynamicRegistration &&
params.capabilities.textDocument.colorProvider?.dynamicRegistration &&
params.capabilities.textDocument.codeAction?.dynamicRegistration &&
@@ -2340,7 +2356,7 @@ connection.onInitialize(async (params: InitializeParams): Promise<InitializeResult> => {
tw.initializeParams = params
TextDocuments,
-import findUp from 'find-up'
+import { debounce } from 'debounce'
return {
capabilities: {
textDocumentSync: TextDocumentSyncKind.Full,
@@ -2349,7 +2365,7 @@ }
}
TextDocuments,
-import { AtRule, Container, Node, Result } from 'postcss'
+import { getModuleDependencies } from './util/getModuleDependencies'
return {
capabilities: {