@@ -2,6 +2,7 @@ import 'dart:async';
22import 'dart:convert' ;
33import 'dart:io' ;
44import 'package:flutter/material.dart' ;
5+ import 'package:flutter/rendering.dart' ;
56
67import '../utils/utils.dart' ;
78import 'package:web_socket_channel/web_socket_channel.dart' ;
@@ -24,6 +25,13 @@ sealed class LspConfig {
2425 /// The workspacePath is the root directory of the project or workspace.
2526 /// If you are using a single file, you can set it to the parent directory of the file.
2627 final String workspacePath;
28+
29+ /// Whether to disable warnings from the LSP server.
30+ final bool disableWarning;
31+
32+ /// Whether to disable errors from the LSP server.
33+ final bool disableError;
34+
2735 final StreamController <Map <String , dynamic >> _responseController =
2836 StreamController .broadcast ();
2937 int _nextId = 1 ;
@@ -33,6 +41,8 @@ sealed class LspConfig {
3341 required this .filePath,
3442 required this .workspacePath,
3543 required this .languageId,
44+ this .disableWarning = false ,
45+ this .disableError = false ,
3646 });
3747
3848 void dispose ();
@@ -178,8 +188,22 @@ sealed class LspConfig {
178188 method: 'textDocument/hover' ,
179189 params: _commonParams (line, character),
180190 );
181- if (response['result' ] == null || response['result' ].isEmpty) return '' ;
182- return response['result' ]? ['contents' ]? ['value' ] ?? '' ;
191+ final contents = response['result' ]? ['contents' ];
192+ if (contents == null || contents.isEmpty) return '' ;
193+ if (contents is String ) return contents;
194+ if (contents is Map && contents.containsKey ('value' )) {
195+ return contents['value' ] ?? '' ;
196+ }
197+ if (contents is List && contents.isNotEmpty) {
198+ return contents
199+ .map ((item) {
200+ if (item is String ) return item;
201+ if (item is Map && item.containsKey ('value' )) return item['value' ];
202+ return '' ;
203+ })
204+ .join ('\n ' );
205+ }
206+ return '' ;
183207 }
184208
185209 Future <String > getDefinition (int line, int character) async {
0 commit comments