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