Skip to content

Commit 4b5b441

Browse files
committed
Don't tell sourcekit-lsp about .swift-version files
1 parent b0d7a20 commit 4b5b441

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/sourcekit-lsp/LanguageClientConfiguration.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class LanguagerClientDocumentSelectors {
112112
{ scheme: "file", language: "plaintext", pattern: "**/.swift-version" },
113113
];
114114

115-
static allHandledDocumentTypes(): DocumentSelector {
115+
static sourcekitLSPDocumentTypes(): DocumentSelector {
116116
let documentSelector: SourceKitDocumentSelector;
117117
switch (configuration.lsp.supportCFamily) {
118118
case "enable":
@@ -142,9 +142,15 @@ export class LanguagerClientDocumentSelectors {
142142
return configuration.lsp.supportedLanguages.includes(doc.language);
143143
});
144144
documentSelector.push(...LanguagerClientDocumentSelectors.documentationDocumentSelector);
145-
documentSelector.push(...LanguagerClientDocumentSelectors.miscelaneousDocumentSelector);
146145
return documentSelector;
147146
}
147+
148+
static allHandledDocumentTypes(): DocumentSelector {
149+
return [
150+
...this.sourcekitLSPDocumentTypes(),
151+
...LanguagerClientDocumentSelectors.miscelaneousDocumentSelector,
152+
];
153+
}
148154
}
149155

150156
export function lspClientOptions(
@@ -159,7 +165,7 @@ export function lspClientOptions(
159165
) => void
160166
): LanguageClientOptions {
161167
return {
162-
documentSelector: LanguagerClientDocumentSelectors.allHandledDocumentTypes(),
168+
documentSelector: LanguagerClientDocumentSelectors.sourcekitLSPDocumentTypes(),
163169
revealOutputChannelOn: RevealOutputChannelOn.Never,
164170
workspaceFolder: workspaceFolder,
165171
outputChannel: new SwiftOutputChannel("SourceKit Language Server"),

src/sourcekit-lsp/inlayHints.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class SwiftLegacyInlayHintsProvider implements vscode.InlayHintsProvider {
6868
/** activate the inlay hints */
6969
export function activateLegacyInlayHints(client: langclient.LanguageClient): vscode.Disposable {
7070
const inlayHint = vscode.languages.registerInlayHintsProvider(
71-
LanguagerClientDocumentSelectors.allHandledDocumentTypes(),
71+
LanguagerClientDocumentSelectors.sourcekitLSPDocumentTypes(),
7272
new SwiftLegacyInlayHintsProvider(client)
7373
);
7474

0 commit comments

Comments
 (0)