Skip to content

Commit

Permalink
Refactor CSSLanguageServer to improve workspace initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed May 21, 2024
1 parent d4241c9 commit d701125
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/language-server/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import glob from 'fast-glob'
import { URI } from 'vscode-uri'

export declare type Workspace = {
path: string
uri: string
openedTextDocuments: TextDocument[]
languageService?: CSSLanguageService
Expand Down Expand Up @@ -168,7 +167,7 @@ export default class CSSLanguageServer {
}

private async initWorkspaceFolder(workspaceFolderURI: string) {
const workspaceFolderCWD = path.resolve(URI.parse(workspaceFolderURI).fsPath)
const workspaceFolderCWD = URI.parse(workspaceFolderURI).fsPath
let customWorkspaceFolderSettings: Settings | undefined
if (this.clientCapabilities.workspace?.configuration) {
customWorkspaceFolderSettings = await this.connection.workspace.getConfiguration({
Expand Down Expand Up @@ -200,7 +199,6 @@ export default class CSSLanguageServer {
const workspaceURI = URI.file(workspaceDir).toString()
this.console.info(`Added workspace ${workspaceURI}`)
this.workspaces.push({
path: workspaceDir,
uri: workspaceURI,
openedTextDocuments: [],
languageServiceSettings
Expand All @@ -212,7 +210,7 @@ export default class CSSLanguageServer {
let workspaceConfig: Config | undefined
try {
workspaceConfig = exploreConfig({
cwd: workspace.path,
cwd: URI.parse(workspace.uri).fsPath,
found: undefined
})
} catch (e: any) {
Expand Down

0 comments on commit d701125

Please sign in to comment.