summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio/LanguageClient.h
AgeCommit message (Collapse)Author
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-06HackStudio: Restart LanguageServer if it crashesItamar
We now restart the language server transparently if it crashes. If the language server crashes too frequently (current threshold is twice within 3 seconds), we give up and will not attempt to restart it again. HackStudio will still work fine, but features that depend on the language server will not function. To support this change we use a new class, 'ServerConnectionWrapper', that holds the actual ServerConnection and is responsible for restarting the language-server if it crashes. Closes #5574.
2021-03-06HackStudio: Map connections to langauge-servers by language nameItamar
HackStudio keeps a map that stores the different ServerConnection instances we have open. Previously, that map was indexed by a project's root path. This did not make much sense because we only support opening a single project with each instance of the HackStudio program. We now index the different ServerConnections by the language name, which allows us to support talking to multiple language-servers in the same project (e.g C++ and Shell). This also fixes an issue where if you first opened a Shell file, and then a C++ file in the same project, then C++ language-server features would not work.
2021-03-02LanguageServers/Cpp: Fix nullptr dereference in ~LanguageClientItamar
The WeakPtr to the ServerConnection is nullified if the server crashes. Closes #5570.
2021-03-02LanguageServers/Cpp: Fix typoItamar
2021-02-27LanguageServers/Cpp: Update client asynchronously about symbolsItamar
As a document is parsed, the language server updates the client asynchronously about symbol declarations it finds.
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-20LanguageServers/Cpp: Add 'FindDeclaration' capabilityItamar
The C++ LanguageServer can now find the matching declaration for variable names, function calls, struct/class types and properties. When clicking on one of the above with Ctrl pressed, HackStudio will ask the language server to find a matching declaration, and navigate to the result in the Editor. :^)
2021-02-13HackStudio: Handle crash of the LanguageServer gracefullyItamar
Previously, HackStudio exited whenever a LanguageServer crashed. Now, we disconnect all clients from that language server instance and show a nice notification.
2021-02-08LanguageServers/Cpp: Add FileDB and pass project_root in Greet()Itamar
FileDB wraps the access to the contents of project files. When asked to fetch a file, FileDB will either return its in-memory model of the file if it has been "opened" by the language-server protocol, or otherwise fetch it from the filesystem. Previously, the cpp language server did not pledge "rpath" and got access to the contents of files whenever they were opened by the language client. However, features like inspection of header files require the language server to get the content of files that were not opened by the client. The language server now pledges rpath but makes sure to only unveil the project's directory and /usr/include.
2021-02-01LibIPC: Stop sending client ID to clientsAndreas Kling
The client ID is not useful to normal clients anymore, so stop telling everyone what their ID is.
2021-01-27HackStudio: Integate with C++ parser-based autocompleteItamar
By default, C++ auto completion will still be performed by the lexer-based logic. However, the parser-based logic can be switched on via the menubar.
2021-01-27HackStudio: Attach previous Language Client when detachingItamar
Previously, if a new LanguageClient was created & destroyed, the ServerConnection to the language server would be left without an attached LanguageClient. As a result, auto-completion results would not be updated in the UI. Starting with this commit, the LanguageClient holds a WeakPtr to the previous LanguageClient that was attached to the ServerConnection, and re-attaches it after detaching itself.
2021-01-12DevTools: Move to Userland/DevTools/Andreas Kling