Skip to content

Commit 2fb8c42

Browse files
committed
Dont print sourcekit-lsp logs to console
1 parent 2d32097 commit 2fb8c42

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/sourcekit-lsp/LanguageClientManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ export class LanguageClientManager {
443443
documentSelector: LanguageClientManager.documentSelector,
444444
revealOutputChannelOn: langclient.RevealOutputChannelOn.Never,
445445
workspaceFolder: workspaceFolder,
446-
outputChannel: new SwiftOutputChannel("SourceKit Language Server"),
446+
outputChannel: new SwiftOutputChannel("SourceKit Language Server", false),
447447
middleware: {
448448
provideDocumentSymbols: async (document, token, next) => {
449449
const result = await next(document, token);

src/ui/SwiftOutputChannel.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,25 @@ import configuration from "../configuration";
1818
export class SwiftOutputChannel implements vscode.OutputChannel {
1919
private channel: vscode.OutputChannel;
2020
private logStore = new RollingLog(1024 * 1024 * 5);
21+
private logToConsole: boolean;
2122

2223
public name: string;
2324

2425
/**
2526
* Creates a vscode.OutputChannel that allows for later retrival of logs.
2627
* @param name
2728
*/
28-
constructor(name: string) {
29+
constructor(name: string, logToConsole: boolean = true) {
2930
this.name = name;
31+
this.logToConsole = process.env["CI"] !== "1" && logToConsole;
3032
this.channel = vscode.window.createOutputChannel(name);
3133
}
3234

3335
append(value: string): void {
3436
this.channel.append(value);
3537
this.logStore.append(value);
3638

37-
if (process.env["CI"] !== "1") {
39+
if (this.logToConsole) {
3840
console.log(value);
3941
}
4042
}
@@ -43,7 +45,7 @@ export class SwiftOutputChannel implements vscode.OutputChannel {
4345
this.channel.appendLine(value);
4446
this.logStore.appendLine(value);
4547

46-
if (process.env["CI"] !== "1") {
48+
if (this.logToConsole) {
4749
console.log(value);
4850
}
4951
}

0 commit comments

Comments
 (0)