mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-11 03:13:51 +00:00
CLI: Fix project index-file command not using only the relevant language server to index the given file
Resolves #1965
This commit is contained in:
1 parent
c8ef9d358e
commit
813fd98f4f
2 files changed
+13
-10
No files matched your search
@@ -42,6 +42,9 @@ Status of the `main` branch. Changes prior to the next official version change w
|
||||
independently via the `window/logMessage` notification tsserver already sends, and the
|
||||
affected wait now raises instead of reporting success (#1814)
|
||||
|
||||
CLI:
|
||||
- Fix `project index-file` command not using only the relevant language server to index the given file (#1965)
|
||||
|
||||
* Dependencies:
|
||||
- Remove the redundant `dotenv` dependency; the `dotenv` module is provided by `python-dotenv`
|
||||
|
||||
|
||||
+10
-10
@@ -893,16 +893,16 @@ class ProjectCommands(AutoRegisteringGroup):
|
||||
exit(1)
|
||||
ls_mgr = proj.create_language_server_manager()
|
||||
try:
|
||||
for ls in ls_mgr.iter_language_servers():
|
||||
click.echo(f"Indexing for language {ls.ls_id.value} …")
|
||||
document_symbols = ls.request_document_symbols(file)
|
||||
symbols, _ = document_symbols.get_all_symbols_and_roots()
|
||||
if verbose:
|
||||
click.echo(f"Symbols in file '{file}':")
|
||||
for symbol in symbols:
|
||||
click.echo(f" - {symbol['name']} at line {symbol['selectionRange']['start']['line']} of kind {symbol['kind']}")
|
||||
ls.save_cache()
|
||||
click.echo(f"Successfully indexed file '{file}', {len(symbols)} symbols saved to cache in {ls.cache_dir}.")
|
||||
ls = ls_mgr.get_language_server(file)
|
||||
click.echo(f"Indexing for language {ls.ls_id.value} …")
|
||||
document_symbols = ls.request_document_symbols(file)
|
||||
symbols, _ = document_symbols.get_all_symbols_and_roots()
|
||||
if verbose:
|
||||
click.echo(f"Symbols in file '{file}':")
|
||||
for symbol in symbols:
|
||||
click.echo(f" - {symbol['name']} at line {symbol['selectionRange']['start']['line']} of kind {symbol['kind']}")
|
||||
ls.save_cache()
|
||||
click.echo(f"Successfully indexed file '{file}', {len(symbols)} symbols saved to cache in {ls.cache_dir}.")
|
||||
finally:
|
||||
ls_mgr.stop_all()
|
||||
|
||||
|
||||
Reference in new issue
Block a user