mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 17:19:01 +01:00
Move smart select and folding to md language server (#154334)
* Move smart select and folding to md language server Also fixes a few minor issues: - Don't log to web console - Remove convert code since it is no longer needed - Use correct extension id * bump cache * Bump package version Co-authored-by: João Moreno <joao.moreno@microsoft.com>
This commit is contained in:
@@ -5,14 +5,7 @@
|
||||
|
||||
import { ILogger } from 'vscode-markdown-languageservice';
|
||||
|
||||
class ConsoleLogger implements ILogger {
|
||||
|
||||
public verbose(title: string, message: string, data?: any): void {
|
||||
this.appendLine(`[Verbose ${ConsoleLogger.now()}] ${title}: ${message}`);
|
||||
if (data) {
|
||||
this.appendLine(ConsoleLogger.data2String(data));
|
||||
}
|
||||
}
|
||||
export class LogFunctionLogger implements ILogger {
|
||||
|
||||
private static now(): string {
|
||||
const now = new Date();
|
||||
@@ -21,10 +14,6 @@ class ConsoleLogger implements ILogger {
|
||||
+ ':' + String(now.getUTCSeconds()).padStart(2, '0') + '.' + String(now.getMilliseconds()).padStart(3, '0');
|
||||
}
|
||||
|
||||
private appendLine(value: string): void {
|
||||
console.log(value);
|
||||
}
|
||||
|
||||
private static data2String(data: any): string {
|
||||
if (data instanceof Error) {
|
||||
if (typeof data.stack === 'string') {
|
||||
@@ -37,6 +26,21 @@ class ConsoleLogger implements ILogger {
|
||||
}
|
||||
return JSON.stringify(data, undefined, 2);
|
||||
}
|
||||
|
||||
constructor(
|
||||
private readonly _logFn: typeof console.log
|
||||
) { }
|
||||
|
||||
public verbose(title: string, message: string, data?: any): void {
|
||||
this.appendLine(`[Verbose ${LogFunctionLogger.now()}] ${title}: ${message}`);
|
||||
if (data) {
|
||||
this.appendLine(LogFunctionLogger.data2String(data));
|
||||
}
|
||||
}
|
||||
|
||||
private appendLine(value: string): void {
|
||||
this._logFn(value);
|
||||
}
|
||||
}
|
||||
|
||||
export const consoleLogger = new ConsoleLogger();
|
||||
export const consoleLogger = new LogFunctionLogger(console.log);
|
||||
|
||||
Reference in New Issue
Block a user