Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Use lint config from workspace/configuration #233

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions packages/server/src/createServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,15 @@ export function createServerWithConnection(
logger.error(e)
}
})
const connections =

const settings =
(hasConfigurationCapability &&
(
await connection.workspace.getConfiguration({
section: 'sqlLanguageServer',
})
)?.connections) ||
[]
(await connection.workspace.getConfiguration({
section: 'sqlLanguageServer',
}))) ||
null

const connections = (settings?.connections ?? []) as SettingConnection[]
if (connections.length > 0) {
SettingStore.getInstance().setSettingFromWorkspaceConfig(connections)
} else if (rootPath) {
Expand All @@ -192,6 +193,14 @@ export function createServerWithConnection(
rootPath || ''
)
}

const lint = settings?.lint as RawConfig
lintConfig = lint
if (lint?.rules) {
documents.all().forEach((v) => {
makeDiagnostics(v)
})
}
})

connection.onDidChangeConfiguration((change) => {
Copy link
Author

@elliotfklein elliotfklein Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the above changes are just copied from the second half of this event handler

Expand Down