-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't break when generating rules produces an error (#954)
* Use `node:util` to format LSP console messages * Don’t break intellisense when generating rules throws an error for a single utility
- Loading branch information
1 parent
daa8bb2
commit 7f503d5
Showing
4 changed files
with
30 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { Connection } from 'vscode-languageserver' | ||
import { format } from 'node:util' | ||
|
||
function formatForLogging(params: any[]): string { | ||
return params.map((item) => format(item)).join(' ') | ||
} | ||
|
||
export function interceptLogs(console: Console, connection: Connection) { | ||
console.debug = (...params: any[]) => connection.console.info(formatForLogging(params)) | ||
console.error = (...params: any[]) => connection.console.error(formatForLogging(params)) | ||
console.warn = (...params: any[]) => connection.console.warn(formatForLogging(params)) | ||
console.info = (...params: any[]) => connection.console.info(formatForLogging(params)) | ||
console.log = (...params: any[]) => connection.console.log(formatForLogging(params)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters