reqlanOverviewIdeasFilesCode filesClustersAttributesGraphPrint

Printable idea sheet

language_server_rust

reqlan rq/extension/language/support/language-server-rust.rq:8

Katz 0.580

A Rust binary replaces the Langium language-server process.
The extension launches `reqlan-lsp` over stdio.
Open `.rq` buffers parse with parser_rust.
The open sequence is open_file_algorithm.
Workspace names and rename targets come from the ideas index under application_memory.
Inbound hints wait for the host snapshot of that index.
The inbound inlay hover is markdown. It lists each referencer as a file link.
An idea hover shows styled idea content when idea_content_tooltip is on.
A closed file has no retained syntax tree.
Go-to-definition cost is reference_goto_definition_speed.
When the engine is `rust`, the server also serves `rq:…` document links, go-to-definition, and missing-idea diagnostics in non- `.rq` comments.
One resolution supplies the link, the definition target, and the underline.
The host strips file document links; Ctrl + click uses definition ( editor_reference_activation ).
The host serves those links when the engine is `node`.
Host commands prefer LSP custom requests, napi extract, and the ideas index.
Move / delete planners still use Langium until index-backed planners land.
The setting `reqlan.languageServer.engine` selects the binary.
The default is `rust`.
`node` remains only when the setting says so, or when the binary is not on disk yet.
A local extension build compiles this binary with the napi addon ( extension_host_native_stage ).
The extension launches `bin/reqlan-lsp`, else that release build. It never launches a debug build, because a debug build is slow and the extension build does not refresh it.
Code actions match code_actions: ignore, create below, import fixes, search or wrap, idea move and delete, and barrel page.
Attribute and name catalogs drive completion. Rename and find-references use open buffers plus the ideas index.
Inlay hints honour `reqlan.referencesInlayHints.enabled` and the host inbound snapshot.
An import link uses the parser token span ( import_from ).
The path links to the file.
An imported idea name and its alias each link to that declaration.
A namespace reference links the alias and the idea as separate names.
A missing leaf reports an unresolved idea on that name.
Related: language_server, grammar_and_parser, analytical_rust_port, vsix_export.

implementation
lib.rs, server.rs, session.rs, analysis.rs, hover_content.rs, code_actions.rs, language-server-launch.ts, main.ts, collect-napi-binary.mjs, stage-host-native.mjs, package-extension-targets.mjs, azure-pipelines.yml
plan
goal
A Rust language-server binary replaces the Langium process. Open buffers parse with reqlan-parse. Workspace names come from the ideas index. Closed files have no retained syntax tree.

constraints
- vscode-languageclient stays. Transport becomes stdio.
- lsp-server and lsp-types only. No second parser.
- Open-file links follow open_file_algorithm.
- UTF-8 spans convert to UTF-16 LSP positions.
- TextMate stays a checked-in grammar. The editor paints it before semantic tokens.
- With the rust engine, non-.rq comment links come from the server. The node engine keeps the host provider.
- Per-target VSIX ships bin/reqlan-lsp. The napi addon stays for the index host.
- Default engine is rust. Node starts only as a fallback.

steps
1. Write this idea and point language_server and grammar_and_parser at it.
2. Scaffold reqlan-lsp: initialize, didOpen, didChange, didClose, parse diagnostics.
3. Launch it from the extension. Default is rust.
4. Port open-file features: tokens, links, definition, hover, highlight, diagnostics.
5. Read the ideas index for completion, rename, code actions, lenses, and inlays.
6. Pack the binary in the VSIX matrix.
7. Keep Langium only for host helpers. The server process does not load it when the engine is rust.

open
- Host move/delete/barrel planners still use Langium DI.
status
in-progress
tests
session.rs:open_file_diagnostics_and_close_drops_the_parse, session.rs:semantic_token_range_matches_the_source_name, session.rs:definition_hover_highlight_and_link, session.rs:definition_uses_the_open_neighbor_parse, session.rs:definition_does_not_reread_a_cached_neighbor, session.rs:folder_reference_link_is_a_command, hover_content.rs:hover_shows_styled_idea_content_by_default, hover_content.rs:hover_omits_idea_content_when_the_setting_is_off, hover_content.rs:hover_shows_idea_content_from_another_file, session.rs:neighbor_confirm_suppresses_missing_idea, session.rs:rq_ignore_suppresses_the_next_line, session.rs:completion_rename_and_code_action, session.rs:index_completion_inlay_and_custom_requests, session.rs:attribute_catalog_completion_and_find_references, stdio.rs:stdio_initialize_and_shutdown, parity.rs:same_file_idea_references_produce_document_links, parity.rs:missing_file_references_do_not_produce_document_links, parity.rs:import_root_alias_file_refs_match_check, parity.rs:import_root_config_file_refs_match_check, parity.rs:anonymous_import_path_does_not_report_an_unresolved_import, parity.rs:reports_an_error_when_an_import_path_file_does_not_exist, parity.rs:reports_an_error_when_an_imported_idea_does_not_exist, parity.rs:anonymous_qualified_idea_resolves_without_an_import_statement, parity.rs:quoted_path_reaches_an_idea_that_is_not_from_imported, parity.rs:extensionless_path_confirms_the_neighbor_idea, parity.rs:from_import_binds_a_local_reference, parity.rs:from_import_tokens_link_independently, parity.rs:import_document_link_covers_the_path_string, parity.rs:namespace_drill_links_each_segment, parity.rs:namespace_drill_missing_leaf_is_unresolved, parity.rs:namespace_alias_is_a_file_link, parity.rs:formats_inbound_referencers_as_an_inlayed_attribute, parity.rs:truncates_long_referencer_lists_with_a_remainder_suffix, parity.rs:omits_the_inlay_when_there_are_no_inbound_referencers, session.rs:comment_links_share_one_resolution, session.rs:comment_definition_follows_a_resolved_rq_reference, language-server-launch.test.ts:defaults to the rust binary over stdio, language-server-launch.test.ts:launches the release build and never a debug build, code_actions.rs:offers_ignore_error_quick_fix_on_a_line_with_a_linking_error, code_actions.rs:omits_ignore_error_when_only_refactor_is_requested, code_actions.rs:creates_the_missing_idea_below_the_containing_idea, code_actions.rs:offers_all_or_a_specific_unresolved_idea, code_actions.rs:omits_create_below_when_the_caret_idea_has_no_unresolved_local_references, code_actions.rs:omits_create_below_for_a_qualified_unresolved_reference, code_actions.rs:omits_create_below_when_only_refactor_is_requested, code_actions.rs:offers_add_import_and_rewrite_when_a_matching_idea_exists_elsewhere, code_actions.rs:uses_name_catalog_matches_when_documents_are_not_loaded, code_actions.rs:search_and_create_actions_invoke_extension_commands, code_actions.rs:appends_to_an_existing_from_import_for_the_same_path, code_actions.rs:offers_add_import_from_the_ideas_index, code_actions.rs:offers_search_code_action_when_cursor_is_inside_a_resolved_reference, code_actions.rs:offers_wrap_code_action_for_a_prose_selection, code_actions.rs:wraps_the_word_under_the_cursor_when_selection_is_empty, code_actions.rs:offers_move_and_delete_actions_at_an_idea_declaration, code_actions.rs:offers_barrel_page_source_action_when_the_file_has_top_level_ideas, code_actions.rs:omits_barrel_page_when_only_quickfix_is_requested_or_there_are_no_ideas
todo
Move/delete and barrel-page host planners still call Langium DI. Finish those off napi/index/LSP.

Interactive page: language_server_rust