Skip to content

Commit f83867d

Browse files
committed
Remove swift.sourcekit-lsp.backgroundPreparationMode
1 parent fc21344 commit f83867d

File tree

3 files changed

+52
-67
lines changed

3 files changed

+52
-67
lines changed

package.json

+27-49
Original file line numberDiff line numberDiff line change
@@ -437,28 +437,6 @@
437437
"markdownDescription": "Arguments to pass to SourceKit-LSP. Keys and values should be provided as individual entries in the list. e.g. `['--log-level', 'debug']`",
438438
"order": 2
439439
},
440-
"swift.sourcekit-lsp.backgroundIndexing": {
441-
"type": "boolean",
442-
"default": false,
443-
"markdownDescription": "Enable or disable background indexing. This option has no effect in Swift versions prior to 6.0.",
444-
"order": 3
445-
},
446-
"swift.sourcekit-lsp.backgroundPreparationMode": {
447-
"type": "string",
448-
"enum": [
449-
"build",
450-
"noLazy",
451-
"enabled"
452-
],
453-
"default": "enabled",
454-
"markdownDescription": "Determines how background indexing should prepare a target. Only used when Background Indexing is enabled. This option has no effect in Swift versions prior to 6.0.",
455-
"enumDescriptions": [
456-
"Build a target to prepare it",
457-
"Prepare a target without generating object files but do not do lazy type checking and function body skipping",
458-
"Prepare a target without generating object files and the like"
459-
],
460-
"order": 4
461-
},
462440
"swift.sourcekit-lsp.supported-languages": {
463441
"type": "array",
464442
"default": [
@@ -479,7 +457,13 @@
479457
"cpp"
480458
]
481459
},
482-
"order": 5
460+
"order": 3
461+
},
462+
"swift.sourcekit-lsp.backgroundIndexing": {
463+
"type": "boolean",
464+
"default": false,
465+
"markdownDescription": "**Experimental**: Enable or disable background indexing. This option has no effect in Swift versions prior to 6.0.",
466+
"order": 4
483467
},
484468
"swift.sourcekit-lsp.trace.server": {
485469
"type": "string",
@@ -490,36 +474,19 @@
490474
"verbose"
491475
],
492476
"markdownDescription": "Controls logging the communication between VS Code and the SourceKit-LSP language server. Logs can be viewed in Output > SourceKit Language Server.",
493-
"order": 6
477+
"order": 5
494478
},
495479
"swift.sourcekit-lsp.disable": {
496480
"type": "boolean",
497481
"default": false,
498482
"markdownDescription": "Disable SourceKit-LSP",
499-
"order": 7
500-
},
501-
"sourcekit-lsp.serverPath": {
502-
"type": "string",
503-
"markdownDescription": "The path of the `sourcekit-lsp` executable. The default is to look in the path where `swift` is found.",
504-
"markdownDeprecationMessage": "**Deprecated**: Please use `#swift.sourcekit-lsp.serverPath#` instead.",
505-
"order": 1
506-
},
507-
"sourcekit-lsp.serverArguments": {
508-
"type": "array",
509-
"default": [],
510-
"items": {
511-
"type": "string"
512-
},
513-
"markdownDescription": "Arguments to pass to SourceKit-LSP. Keys and values should be provided as individual entries in the list. e.g. `['--log-level', 'debug']`",
514-
"markdownDeprecationMessage": "**Deprecated**: Please use `#swift.sourcekit-lsp.serverArguments#` instead.",
515-
"order": 2
483+
"order": 6
516484
},
517485
"sourcekit-lsp.inlayHints.enabled": {
518486
"type": "boolean",
519487
"default": true,
520488
"markdownDescription": "Display Inlay Hints. Inlay Hints are variable annotations indicating their inferred type. They are only available if you are using Swift 5.6 or later.",
521-
"markdownDeprecationMessage": "**Deprecated**: Please use `#editor.inlayHints.enabled#` instead.",
522-
"order": 3
489+
"markdownDeprecationMessage": "**Deprecated**: Please use `#editor.inlayHints.enabled#` instead."
523490
},
524491
"sourcekit-lsp.support-c-cpp": {
525492
"type": "string",
@@ -535,8 +502,21 @@
535502
"Disable when C/C++ extension is active"
536503
],
537504
"markdownDescription": "Add LSP functionality for C/C++ files. By default this is set to disable when the C/C++ extension is active.",
538-
"markdownDeprecationMessage": "**Deprecated**: Please use `#swift.sourcekit-lsp.supported-languages#` instead.",
539-
"order": 5
505+
"markdownDeprecationMessage": "**Deprecated**: Please use `#swift.sourcekit-lsp.supported-languages#` instead."
506+
},
507+
"sourcekit-lsp.serverPath": {
508+
"type": "string",
509+
"markdownDescription": "The path of the `sourcekit-lsp` executable. The default is to look in the path where `swift` is found.",
510+
"markdownDeprecationMessage": "**Deprecated**: Please use `#swift.sourcekit-lsp.serverPath#` instead."
511+
},
512+
"sourcekit-lsp.serverArguments": {
513+
"type": "array",
514+
"default": [],
515+
"items": {
516+
"type": "string"
517+
},
518+
"markdownDescription": "Arguments to pass to SourceKit-LSP. Keys and values should be provided as individual entries in the list. e.g. `['--log-level', 'debug']`",
519+
"markdownDeprecationMessage": "**Deprecated**: Please use `#swift.sourcekit-lsp.serverArguments#` instead."
540520
},
541521
"sourcekit-lsp.trace.server": {
542522
"type": "string",
@@ -547,15 +527,13 @@
547527
"verbose"
548528
],
549529
"markdownDescription": "Traces the communication between VS Code and the SourceKit-LSP language server.",
550-
"markdownDeprecationMessage": "**Deprecated**: Please use `#swift.sourcekit-lsp.trace.server#` instead.",
551-
"order": 6
530+
"markdownDeprecationMessage": "**Deprecated**: Please use `#swift.sourcekit-lsp.trace.server#` instead."
552531
},
553532
"sourcekit-lsp.disable": {
554533
"type": "boolean",
555534
"default": false,
556535
"markdownDescription": "Disable the running of SourceKit-LSP.",
557-
"markdownDeprecationMessage": "**Deprecated**: Please use `#swift.sourcekit-lsp.disable#` instead.",
558-
"order": 7
536+
"markdownDeprecationMessage": "**Deprecated**: Please use `#swift.sourcekit-lsp.disable#` instead."
559537
}
560538
}
561539
},

src/configuration.ts

-6
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,6 @@ const configuration = {
231231
.getConfiguration("swift.sourcekit-lsp")
232232
.get("backgroundIndexing", false);
233233
},
234-
/** background preparation mode */
235-
get backgroundPreparationMode(): "build" | "noLazy" | "enabled" {
236-
return vscode.workspace
237-
.getConfiguration("swift.sourcekit-lsp")
238-
.get("backgroundPreparationMode", "enabled");
239-
},
240234
/** focus on problems view whenever there is a build error */
241235
get actionAfterBuildError(): ActionAfterBuildError {
242236
return vscode.workspace

src/sourcekit-lsp/LanguageClientManager.ts

+25-12
Original file line numberDiff line numberDiff line change
@@ -576,18 +576,7 @@ export class LanguageClientManager {
576576
// Avoid attempting to reinitialize multiple times. If we fail to initialize
577577
// we aren't doing anything different the second time and so will fail again.
578578
initializationFailedHandler: () => false,
579-
initializationOptions: {
580-
"workspace/peekDocuments": true, // workaround for client capability to handle `PeekDocumentsRequest`
581-
"workspace/getReferenceDocument": true, // the client can handle URIs with scheme `sourcekit-lsp:`
582-
"textDocument/codeLens": {
583-
supportedCommands: {
584-
"swift.run": "swift.run",
585-
"swift.debug": "swift.debug",
586-
},
587-
},
588-
backgroundIndexing: configuration.backgroundIndexing,
589-
backgroundPreparationMode: configuration.backgroundPreparationMode,
590-
},
579+
initializationOptions: this.initializationOptions(),
591580
};
592581

593582
return {
@@ -601,6 +590,30 @@ export class LanguageClientManager {
601590
};
602591
}
603592

593+
/* eslint-disable @typescript-eslint/no-explicit-any */
594+
private initializationOptions(): any {
595+
let options: any = {
596+
"workspace/peekDocuments": true, // workaround for client capability to handle `PeekDocumentsRequest`
597+
"workspace/getReferenceDocument": true, // the client can handle URIs with scheme `sourcekit-lsp:`
598+
"textDocument/codeLens": {
599+
supportedCommands: {
600+
"swift.run": "swift.run",
601+
"swift.debug": "swift.debug",
602+
},
603+
},
604+
};
605+
606+
if (configuration.backgroundIndexing) {
607+
options = {
608+
...options,
609+
backgroundIndexing: configuration.backgroundIndexing,
610+
backgroundPreparationMode: "enabled",
611+
};
612+
}
613+
return options;
614+
}
615+
/* eslint-enable @typescript-eslint/no-explicit-any */
616+
604617
private async startClient(
605618
client: langclient.LanguageClient,
606619
errorHandler: SourceKitLSPErrorHandler

0 commit comments

Comments
 (0)