Commit graph

15 commits

Author SHA1 Message Date
Itamar
b35293d945 LibCodeComprehension: Re-organize code comprehension related code
This moves all code comprehension-related code to a new library,
LibCodeComprehension.

This also moves some types related to code comprehension tasks (such as
autocomplete, find declaration) out of LibGUI and into
LibCodeComprehension.
2022-05-21 18:15:58 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Itamar
9cd27d1e15 LanguageServers/Cpp: Add SemanticType::PreprocessorMacro
This adds a new semantic token type, PreprocessorMacro.

Calls to preprocessor macros will now be highlighted when semantic
highlighting is enabled in Hack Studio.
2022-03-31 19:10:15 +02:00
Itamar
33043f269d HackStudio: Add tokens_info_result() and tokens_info_result() IPC calls
These IPC calls are used in the communication with the language server
to fetch semantic information about the tokens in a code document.
2022-02-09 00:51:31 +01:00
Itamar
76000e9137 LanguageServers/Cpp: Make find_declaration_of() more flexible
Previously, find_declaration_of() only worked for AST nodes of type
Identifier. It now also works for declaration node, member variables
and function parameters.
2022-02-09 00:51:31 +01:00
Andreas Kling
8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
thislooksfun
a6a71869d7 HackStudio: Handle autocomplete inside #include's <> and "" 2021-11-02 17:53:22 +01:00
Itamar
9ae98bc81b LibCpp: Handle circular imports gracefully
This patch prevents CppComprehensionEngine from endlessly looping when
there's a circular #include in the code.

We now keep track of the set of currently processed files, and will not
re-process a file if it already exists in this set.
When we're done with processing a file it is removed from this set.

The pragma once directive is not yet implemented, but regardless a
mechanism that prevents #include loops even in the absence of
pragma once is desired.
2021-08-19 17:20:37 +02:00
Itamar
32be65a8b4 CppLanguageServer: Add "get_parameters_hint" capability
Given a call site, the C++ language server can now return the declared
parameters of the called function, as well as the index of the
parameter that the cursor is currently at.
2021-07-04 17:50:33 +02:00
Itamar
ccb52b005e CppLanguageServer: Make properties_of_type return any property
Previously, CppComprehensionEngine::properties_of_type only returned
variables.
2021-06-29 00:07:19 +04:30
Federico Guerinoni
26a7356e90 LanguageServers: Add function to collect TODO entries in a document 2021-06-23 19:00:11 +01:00
Itamar
4f1889c2cb CppLanguageServer: Work with a HashMap of Symbols in each document
This is a pretty fundamental refactor of the way
CppComprehensionEngine works.

Previously, in order to answer queries such as "goto definition" or
"autocomplete", we would do ad-hoc logic of walking the AST,
collecting available declaration nodes, computing scopes, and so on.

This commit introduces an architectural change where each Document
builds a hashmap of symbols on creation.

With these hashmaps, it's easier to iterate over all of the available
symbols, and to answer a query such as "which symbols are defined in
this scope".
2021-06-01 22:20:13 +02:00
Itamar
c003c3c76d CppLanguageServer+LibGUI: Autocomplete #include paths
The C++ language-server can now autocomplete include paths.

Paths that start with '<' will be searched in /usr/include, and paths
that start with '"' will be searched in the project's root directory.
2021-05-22 15:52:11 +02:00
Itamar
b50eaf75eb CppLanguageServer: Rename Optional<> autocomplete* to try_autocomplete*
autocomplete_property => try_autocomplete_property
autocomplete_name => try_autocomplete_name

This makes it more clear that these variants may fail because e.g
the node is not a property / not a name.
2021-05-22 15:52:11 +02:00
Itamar
400d3ddb08 LanguageServers: Rename AutoCompleteEngine => CodeComprehensionEngine
This feels like a better name since the "autocomplete engine" can, in
addition to providing autocomplete suggestions, also find declarations
of symbols and report back the symbols that are defined in a document.

Also, Cpp/ParserAutoComplete has been renamed to CppComprehensionEngine
and Shell/AutoComplete has been renamed to ShellComprehensionEngine.
2021-05-16 16:39:21 +02:00
Renamed from Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.h (Browse further)