Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for documentSymbolProvider and workspaceSymbolProvider #22

Open
wants to merge 3 commits into
base: parser
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge remote-tracking branch 'Original/parser' into parser
  • Loading branch information
simonvanbernem committed Oct 25, 2024
commit ba5db5fee9d577e52419a73f96d948548a6e4187
2 changes: 2 additions & 0 deletions server/main.jai
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ handle_request :: (request: LSP_Request_Message, raw_request: string) {
}

handle_hover(body);
json_free(xx body);

case "textDocument/documentSymbol";
//ZoneScoped("textDocument/documentSymbol");
success, body := json_parse_string(raw_request, LSP_Request_Message_Document_Symbol);
Expand Down
21 changes: 20 additions & 1 deletion server/program.jai
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Program_File :: struct {
declaration_hierarchy: Table(*Declaration, [..]*Declaration);
serialized_workspace_symbols: Table(string, string);
linked_files : [] Linked_File; // @TODO: this is probably stupid name for this!

ast_pool: Pool;
analysis_pool: Pool;
}

Linked_File :: struct {
Expand Down Expand Up @@ -169,7 +172,23 @@ analyze_files :: () {
}

for file: server.files_to_be_analyzed {
resolve_identifiers(file);
linked_files := get_file_links(file,, pool_alloc(*file.analysis_pool));

if file != preload_file && preload_file {
array_add(*linked_files, .{ file=preload_file, from_import=true });
}

if file != runtime_support_file && runtime_support_file {
array_add(*linked_files, .{ file=runtime_support_file, from_import=true });
}

file.linked_files = linked_files;
}

for file: server.files_to_be_analyzed {
table_reset(*file.resolved_identifiers);
resolve_identifiers(file,, pool_alloc(*file.analysis_pool));
// log("Analyzed: %", file.path);
build_declaration_hierarchy(file);
generate_and_serialize_workspace_symbols_for_file(file);
}
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.