File tree Expand file tree Collapse file tree 2 files changed +14
-19
lines changed Expand file tree Collapse file tree 2 files changed +14
-19
lines changed Original file line number Diff line number Diff line change @@ -327,29 +327,15 @@ impl GlobalState {
327327 continue ;
328328 }
329329
330- let url = file_id_to_url ( & self . vfs . read ( ) . 0 , file_id) ;
331- let mut diagnostics =
330+ let uri = file_id_to_url ( & self . vfs . read ( ) . 0 , file_id) ;
331+ let diagnostics =
332332 self . diagnostics . diagnostics_for ( file_id) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
333- for d in & mut diagnostics {
334- // https://github.com/rust-lang/rust-analyzer/issues/11404
335- // FIXME: We should move this workaround into the client code
336- if d. message . is_empty ( ) {
337- d. message = " " . to_string ( ) ;
338- }
339- if let Some ( rds) = d. related_information . as_mut ( ) {
340- for rd in rds {
341- if rd. message . is_empty ( ) {
342- rd. message = " " . to_string ( ) ;
343- }
344- }
345- }
346- }
347- let version = from_proto:: vfs_path ( & url)
333+ let version = from_proto:: vfs_path ( & uri)
348334 . map ( |path| self . mem_docs . get ( & path) . map ( |it| it. version ) )
349335 . unwrap_or_default ( ) ;
350336
351337 self . send_notification :: < lsp_types:: notification:: PublishDiagnostics > (
352- lsp_types:: PublishDiagnosticsParams { uri : url , diagnostics, version } ,
338+ lsp_types:: PublishDiagnosticsParams { uri, diagnostics, version } ,
353339 ) ;
354340 }
355341 }
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import * as vscode from "vscode";
33import * as ra from "../src/lsp_ext" ;
44import * as Is from "vscode-languageclient/lib/common/utils/is" ;
55import { assert } from "./util" ;
6- import { WorkspaceEdit } from "vscode" ;
6+ import { Uri , WorkspaceEdit } from "vscode" ;
77import { Workspace } from "./ctx" ;
88import { updateConfig } from "./config" ;
99import { substituteVariablesInEnv } from "./config" ;
@@ -105,6 +105,15 @@ export async function createClient(
105105 traceOutputChannel : traceOutputChannel ( ) ,
106106 outputChannel : outputChannel ( ) ,
107107 middleware : {
108+ async handleDiagnostics ( uri , diagnostics , next ) {
109+ // Workaround for https://github.com/microsoft/vscode/issues/155531
110+ for ( const diagnostic of diagnostics ) {
111+ if ( ! diagnostic . message ) {
112+ diagnostic . message = " " ;
113+ }
114+ }
115+ next ( uri , diagnostics ) ;
116+ } ,
108117 async provideHover (
109118 document : vscode . TextDocument ,
110119 position : vscode . Position ,
You can’t perform that action at this time.
0 commit comments