register disposables
parent
da69936f11
commit
c1467b75f3
|
@ -62,7 +62,6 @@ function sortedWorkspaceFolders(): string[] {
|
|||
}
|
||||
return _sortedWorkspaceFolders
|
||||
}
|
||||
Workspace.onDidChangeWorkspaceFolders(() => (_sortedWorkspaceFolders = undefined))
|
||||
|
||||
function getOuterMostWorkspaceFolder(folder: WorkspaceFolder): WorkspaceFolder {
|
||||
let sorted = sortedWorkspaceFolders()
|
||||
|
@ -111,6 +110,7 @@ export function activate(context: ExtensionContext) {
|
|||
// TODO: check if the actual language MAPPING changed
|
||||
// not just the language IDs
|
||||
// e.g. "plaintext" already exists but you change it from "html" to "css"
|
||||
context.subscriptions.push(
|
||||
Workspace.onDidChangeConfiguration((event) => {
|
||||
clients.forEach((client, key) => {
|
||||
const folder = Workspace.getWorkspaceFolder(Uri.parse(key))
|
||||
|
@ -133,6 +133,7 @@ export function activate(context: ExtensionContext) {
|
|||
}
|
||||
})
|
||||
})
|
||||
)
|
||||
|
||||
function bootWorkspaceClient(folder: WorkspaceFolder) {
|
||||
if (clients.has(folder.uri.toString())) {
|
||||
|
@ -146,6 +147,13 @@ export function activate(context: ExtensionContext) {
|
|||
colorDecorationType = undefined
|
||||
}
|
||||
}
|
||||
context.subscriptions.push({
|
||||
dispose() {
|
||||
if (colorDecorationType) {
|
||||
colorDecorationType.dispose()
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
// placeholder so we don't boot another server before this one is ready
|
||||
clients.set(folder.uri.toString(), null)
|
||||
|
@ -159,6 +167,7 @@ export function activate(context: ExtensionContext) {
|
|||
|
||||
if (!outputChannel) {
|
||||
outputChannel = Window.createOutputChannel(CLIENT_NAME)
|
||||
context.subscriptions.push(outputChannel)
|
||||
commands.executeCommand('setContext', 'tailwindCSS.hasOutputChannel', true)
|
||||
}
|
||||
|
||||
|
@ -361,9 +370,12 @@ export function activate(context: ExtensionContext) {
|
|||
bootWorkspaceClient(folder)
|
||||
}
|
||||
|
||||
Workspace.onDidOpenTextDocument(didOpenTextDocument)
|
||||
context.subscriptions.push(Workspace.onDidOpenTextDocument(didOpenTextDocument))
|
||||
Workspace.textDocuments.forEach(didOpenTextDocument)
|
||||
context.subscriptions.push(
|
||||
Workspace.onDidChangeWorkspaceFolders((event) => {
|
||||
_sortedWorkspaceFolders = undefined
|
||||
|
||||
for (let folder of event.removed) {
|
||||
let client = clients.get(folder.uri.toString())
|
||||
if (client) {
|
||||
|
@ -373,6 +385,7 @@ export function activate(context: ExtensionContext) {
|
|||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
export function deactivate(): Thenable<void> {
|
||||
|
|
Loading…
Reference in New Issue