Skip to content

Commit

Permalink
Merge branch 'main' into jetbrains-7
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelangeloio committed Jan 9, 2024
2 parents f5b92ad + 960b486 commit 8f24d91
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,44 +19,27 @@ const connection = createConnection(ProposedFeatures.all)
const documents: TextDocuments<TextDocument> = new TextDocuments(TextDocument)
let hasConfigurationCapability = false
let hasWorkspaceFolderCapability = false
// use if needed later
// let hasDiagnosticRelatedInformationCapability = false

let rootUri: string | undefined | null

connection.onInitialize((params: InitializeParams) => {
const capabilities = params.capabilities

// Does the client support the `workspace/configuration` request?
// If not, we fall back using global settings.
hasConfigurationCapability = !!(capabilities.workspace && !!capabilities.workspace.configuration)
hasWorkspaceFolderCapability = !!(capabilities.workspace && !!capabilities.workspace.workspaceFolders)
// use if needed later
// hasDiagnosticRelatedInformationCapability = !!(
// capabilities.textDocument &&
// capabilities.textDocument.publishDiagnostics &&
// capabilities.textDocument.publishDiagnostics.relatedInformation
// )

const result: InitializeResult = {
capabilities: {
textDocumentSync: TextDocumentSyncKind.Incremental
}
}
if (params?.workspaceFolders && params.workspaceFolders.length > 1) {
throw new Error('This extension only supports one workspace folder at this time')
}
if (hasWorkspaceFolderCapability) {
result.capabilities.workspace = {
workspaceFolders: {
supported: false
supported: true
}
}
}
if (!hasWorkspaceFolderCapability) {
rootUri = params.rootUri
} else {
rootUri = params?.workspaceFolders?.[0]?.uri
}

return result
})

Expand Down

0 comments on commit 8f24d91

Please sign in to comment.