mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Merge pull request #32668 from orta/fix_31209
Suppress console.log & others inside the TS Server runtime so that language service plugins don't accidentally use them and kill the server
This commit is contained in:
commit
b70f894881
@ -982,4 +982,12 @@ namespace ts.server {
|
||||
if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) {
|
||||
ts.sys.tryEnableSourceMapsForHost();
|
||||
}
|
||||
|
||||
// Overwrites the current console messages to instead write to
|
||||
// the log. This is so that language service plugins which use
|
||||
// console.log don't break the message passing between tsserver
|
||||
// and the client
|
||||
console.log = (...args) => logger.msg(args.length === 1 ? args[0] : args.join(", "), Msg.Info);
|
||||
console.warn = (...args) => logger.msg(args.length === 1 ? args[0] : args.join(", "), Msg.Err);
|
||||
console.error = (...args) => logger.msg(args.length === 1 ? args[0] : args.join(", "), Msg.Err);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user