@@ -100,9 +100,8 @@ def run(self, edit: sublime.Edit, event: Optional[Dict[str, Any]] = None) -> Non
100
100
self .view .settings ().set (SUPPRESS_INPUT_SETTING_KEY , True )
101
101
session = self .best_session (self .capability )
102
102
if session :
103
- params = {"textDocument" : text_document_identifier (self .view )}
104
103
session .send_request (
105
- Request ( "textDocument/documentSymbol" , params , self .view , progress = True ),
104
+ Request . documentSymbols ({ "textDocument" : text_document_identifier ( self .view )}, self . view ),
106
105
lambda response : sublime .set_timeout (lambda : self .handle_response (response )),
107
106
lambda error : sublime .set_timeout (lambda : self .handle_response_error (error )))
108
107
@@ -221,11 +220,8 @@ class SymbolQueryInput(sublime_plugin.TextInputHandler):
221
220
def want_event (self ) -> bool :
222
221
return False
223
222
224
- def validate (self , txt : str ) -> bool :
225
- return txt != ""
226
-
227
223
def placeholder (self ) -> str :
228
- return "Symbol "
224
+ return "Enter symbol name "
229
225
230
226
231
227
class LspWorkspaceSymbolsCommand (LspTextCommand ):
@@ -235,15 +231,14 @@ class LspWorkspaceSymbolsCommand(LspTextCommand):
235
231
def input (self , _args : Any ) -> sublime_plugin .TextInputHandler :
236
232
return SymbolQueryInput ()
237
233
238
- def run (self , edit : sublime .Edit , symbol_query_input : str ) -> None :
239
- if symbol_query_input :
240
- session = self .best_session (self .capability )
241
- if session :
242
- params = {"query" : symbol_query_input }
243
- request = Request ("workspace/symbol" , params , None , progress = True )
244
- self .weaksession = weakref .ref (session )
245
- session .send_request (request , lambda r : self ._handle_response (
246
- symbol_query_input , r ), self ._handle_error )
234
+ def run (self , edit : sublime .Edit , symbol_query_input : str , event : Optional [Any ] = None ) -> None :
235
+ session = self .best_session (self .capability )
236
+ if session :
237
+ self .weaksession = weakref .ref (session )
238
+ session .send_request (
239
+ Request .workspaceSymbol ({"query" : symbol_query_input }),
240
+ lambda r : self ._handle_response (symbol_query_input , r ),
241
+ self ._handle_error )
247
242
248
243
def _open_file (self , symbols : List [SymbolInformation ], index : int ) -> None :
249
244
if index != - 1 :
@@ -260,7 +255,7 @@ def _handle_response(self, query: str, response: Union[List[SymbolInformation],
260
255
list (map (symbol_information_to_quick_panel_item , matches )),
261
256
lambda i : self ._open_file (matches , i ))
262
257
else :
263
- sublime .message_dialog ("No matches found for query string : '{}'" .format (query ))
258
+ sublime .message_dialog ("No matches found for query: '{}'" .format (query ))
264
259
265
260
def _handle_error (self , error : Dict [str , Any ]) -> None :
266
261
reason = error .get ("message" , "none provided by server :(" )
0 commit comments