mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Pick up latest markdown language service (#176425)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "vscode-markdown-languageserver",
|
||||
"description": "Markdown language server",
|
||||
"version": "0.3.0-alpha.4",
|
||||
"version": "0.3.0-alpha.6",
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -18,7 +18,7 @@
|
||||
"vscode-languageserver": "^8.0.2",
|
||||
"vscode-languageserver-textdocument": "^1.0.5",
|
||||
"vscode-languageserver-types": "^3.17.1",
|
||||
"vscode-markdown-languageservice": "^0.3.0-alpha.5",
|
||||
"vscode-markdown-languageservice": "^0.3.0-alpha.6",
|
||||
"vscode-uri": "^3.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -73,7 +73,7 @@ export function registerValidateSupport(
|
||||
const emptyDiagnosticsResponse = Object.freeze({ kind: 'full', items: [] });
|
||||
|
||||
connection.languages.diagnostics.on(async (params, token): Promise<FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport> => {
|
||||
logger.log(md.LogLevel.Trace, 'Server: connection.languages.diagnostics.on', params.textDocument.uri);
|
||||
logger.log(md.LogLevel.Debug, 'connection.languages.diagnostics.on', { document: params.textDocument.uri });
|
||||
|
||||
if (!config.getSettings()?.markdown.validate.enabled) {
|
||||
return emptyDiagnosticsResponse;
|
||||
|
||||
@@ -31,14 +31,29 @@ export class LogFunctionLogger implements ILogger {
|
||||
private readonly _logFn: typeof console.log
|
||||
) { }
|
||||
|
||||
get level(): LogLevel {
|
||||
return LogLevel.Debug; // TODO: remove hardcoding
|
||||
}
|
||||
|
||||
public log(level: LogLevel, title: string, message: string, data?: any): void {
|
||||
this.appendLine(`[${level} ${LogFunctionLogger.now()}] ${title}: ${message}`);
|
||||
public log(level: LogLevel, message: string, data?: any): void {
|
||||
if (level < this.level) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.appendLine(`[${this.toLevelLabel(level)} ${LogFunctionLogger.now()}] ${message}`);
|
||||
if (data) {
|
||||
this.appendLine(LogFunctionLogger.data2String(data));
|
||||
}
|
||||
}
|
||||
|
||||
private toLevelLabel(level: LogLevel): string {
|
||||
switch (level) {
|
||||
case LogLevel.Off: return 'Off';
|
||||
case LogLevel.Debug: return 'Debug';
|
||||
case LogLevel.Trace: return 'Trace';
|
||||
}
|
||||
}
|
||||
|
||||
private appendLine(value: string): void {
|
||||
this._logFn(value);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ export class VsCodeClientWorkspace implements md.IWorkspaceWithWatching {
|
||||
return;
|
||||
}
|
||||
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace: TextDocument.onDidOpen', `${e.document.uri}`);
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace.TextDocument.onDidOpen', { document: e.document.uri });
|
||||
|
||||
const uri = URI.parse(e.document.uri);
|
||||
const doc = this._documentCache.get(uri);
|
||||
@@ -141,7 +141,7 @@ export class VsCodeClientWorkspace implements md.IWorkspaceWithWatching {
|
||||
return;
|
||||
}
|
||||
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace: TextDocument.onDidChanceContent', `${e.document.uri}`);
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace.TextDocument.onDidChanceContent', { document: e.document.uri });
|
||||
|
||||
const uri = URI.parse(e.document.uri);
|
||||
const entry = this._documentCache.get(uri);
|
||||
@@ -156,7 +156,7 @@ export class VsCodeClientWorkspace implements md.IWorkspaceWithWatching {
|
||||
return;
|
||||
}
|
||||
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace: TextDocument.onDidClose', `${e.document.uri}`);
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace.TextDocument.onDidClose', { document: e.document.uri });
|
||||
|
||||
const uri = URI.parse(e.document.uri);
|
||||
const doc = this._documentCache.get(uri);
|
||||
@@ -191,7 +191,7 @@ export class VsCodeClientWorkspace implements md.IWorkspaceWithWatching {
|
||||
connection.onDidChangeWatchedFiles(async ({ changes }) => {
|
||||
for (const change of changes) {
|
||||
const resource = URI.parse(change.uri);
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace: onDidChangeWatchedFiles', `${change.type}: ${resource}`);
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace.onDidChangeWatchedFiles', { type: change.type, resource });
|
||||
switch (change.type) {
|
||||
case FileChangeType.Changed: {
|
||||
const entry = this._documentCache.get(resource);
|
||||
@@ -230,7 +230,7 @@ export class VsCodeClientWorkspace implements md.IWorkspaceWithWatching {
|
||||
});
|
||||
|
||||
connection.onRequest(protocol.fs_watcher_onChange, params => {
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace: fs_watcher_onChange', `${params.kind}: ${params.uri}`);
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace.fs_watcher_onChange', { kind: params.kind, uri: params.uri });
|
||||
|
||||
const watcher = this._watchers.get(params.id);
|
||||
if (!watcher) {
|
||||
@@ -342,7 +342,7 @@ export class VsCodeClientWorkspace implements md.IWorkspaceWithWatching {
|
||||
}
|
||||
|
||||
async stat(resource: URI): Promise<md.FileStat | undefined> {
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace: stat', `${resource}`);
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace.stat', { resource });
|
||||
if (this._documentCache.has(resource)) {
|
||||
return { isDirectory: false };
|
||||
}
|
||||
@@ -359,7 +359,7 @@ export class VsCodeClientWorkspace implements md.IWorkspaceWithWatching {
|
||||
}
|
||||
|
||||
async readDirectory(resource: URI): Promise<[string, md.FileStat][]> {
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace: readDir', `${resource}`);
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace.readDir', { resource });
|
||||
return this.connection.sendRequest(protocol.fs_readDirectory, { uri: resource.toString() });
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ export class VsCodeClientWorkspace implements md.IWorkspaceWithWatching {
|
||||
|
||||
watchFile(resource: URI, options: md.FileWatcherOptions): md.IFileSystemWatcher {
|
||||
const id = this._watcherPool++;
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace: watchFile', `(${id}) ${resource}`);
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace.watchFile', { id, resource });
|
||||
|
||||
const entry = {
|
||||
resource,
|
||||
@@ -401,7 +401,7 @@ export class VsCodeClientWorkspace implements md.IWorkspaceWithWatching {
|
||||
onDidChange: entry.onDidChange.event,
|
||||
onDidDelete: entry.onDidDelete.event,
|
||||
dispose: () => {
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace: disposeWatcher', `(${id}) ${resource}`);
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace.disposeWatcher', { id, resource });
|
||||
this.connection.sendRequest(protocol.fs_watcher_delete, { id });
|
||||
this._watchers.delete(id);
|
||||
}
|
||||
@@ -413,7 +413,7 @@ export class VsCodeClientWorkspace implements md.IWorkspaceWithWatching {
|
||||
}
|
||||
|
||||
private doDeleteDocument(uri: URI) {
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace: deleteDocument', `${uri}`);
|
||||
this.logger.log(md.LogLevel.Trace, 'VsCodeClientWorkspace.deleteDocument', { document: uri });
|
||||
|
||||
this._documentCache.delete(uri);
|
||||
this._onDidDeleteMarkdownDocument.fire(uri);
|
||||
|
||||
@@ -52,10 +52,10 @@ vscode-languageserver@^8.0.2:
|
||||
dependencies:
|
||||
vscode-languageserver-protocol "3.17.2"
|
||||
|
||||
vscode-markdown-languageservice@^0.3.0-alpha.5:
|
||||
version "0.3.0-alpha.5"
|
||||
resolved "https://registry.yarnpkg.com/vscode-markdown-languageservice/-/vscode-markdown-languageservice-0.3.0-alpha.5.tgz#fce18193c16186eacdd322f49775fd43d659fc25"
|
||||
integrity sha512-5SEn8hr999N/K8IaY25fdZoW7JPJT4pOm53AQvimGNYiCntb0TWJhMJD1Izbc2DvbyrWAksVkLqzbGKV/zW+Sg==
|
||||
vscode-markdown-languageservice@^0.3.0-alpha.6:
|
||||
version "0.3.0-alpha.6"
|
||||
resolved "https://registry.yarnpkg.com/vscode-markdown-languageservice/-/vscode-markdown-languageservice-0.3.0-alpha.6.tgz#906b49c630279fc156230bfa0bc869d6e958f7de"
|
||||
integrity sha512-r7rXpsQVrfVdD5KLGkZ2imvR/UeeEZlGickM/jQfe0DLUACjry7kGfHlVKBs1pvluOiC0e2bBv9/I0+uqSn2fA==
|
||||
dependencies:
|
||||
"@vscode/l10n" "^0.0.10"
|
||||
picomatch "^2.3.1"
|
||||
|
||||
Reference in New Issue
Block a user