File tree 2 files changed +14
-19
lines changed
2 files changed +14
-19
lines changed Original file line number Diff line number Diff line change @@ -327,29 +327,15 @@ impl GlobalState {
327
327
continue ;
328
328
}
329
329
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 =
332
332
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)
348
334
. map ( |path| self . mem_docs . get ( & path) . map ( |it| it. version ) )
349
335
. unwrap_or_default ( ) ;
350
336
351
337
self . send_notification :: < lsp_types:: notification:: PublishDiagnostics > (
352
- lsp_types:: PublishDiagnosticsParams { uri : url , diagnostics, version } ,
338
+ lsp_types:: PublishDiagnosticsParams { uri, diagnostics, version } ,
353
339
) ;
354
340
}
355
341
}
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import * as vscode from "vscode";
3
3
import * as ra from "../src/lsp_ext" ;
4
4
import * as Is from "vscode-languageclient/lib/common/utils/is" ;
5
5
import { assert } from "./util" ;
6
- import { WorkspaceEdit } from "vscode" ;
6
+ import { Uri , WorkspaceEdit } from "vscode" ;
7
7
import { Workspace } from "./ctx" ;
8
8
import { updateConfig } from "./config" ;
9
9
import { substituteVariablesInEnv } from "./config" ;
@@ -105,6 +105,15 @@ export async function createClient(
105
105
traceOutputChannel : traceOutputChannel ( ) ,
106
106
outputChannel : outputChannel ( ) ,
107
107
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
+ } ,
108
117
async provideHover (
109
118
document : vscode . TextDocument ,
110
119
position : vscode . Position ,
You can’t perform that action at this time.
0 commit comments