summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio/LanguageClient.h
AgeCommit message (Collapse)Author
2023-03-11HackStudio: Use Syntax::Language instead of our own oneSam Atkins
The one behavior difference here is that the statusbar used to display "Unknown" for unknown file types, and "Markdown" for md, but we now display "Plain Text" for all file types without syntax highlighters.
2023-02-13LibCore: Move Stream-based sockets into the `Core` namespaceTim Schumacher
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-05-21LibCodeComprehension: Re-organize code comprehension related codeItamar
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-04-01Everywhere: Run clang-formatIdan Horowitz
2022-02-25HackStudio: Rename HackStudio::ServerConnection=>ConnectionToServerItamar
Also renames ServerConnectionWrapper=>ConnectionToServerWrapper and ServerConnectionInstances=>ConnectionToServerInstances This was done with CLion's automatic rename feature.
2022-02-25Userland: Rename IPC::ServerConnection=>IPC::ConnectionToServerItamar
This was done with CLion's automatic rename feature.
2022-02-09HackStudio: Add tokens_info_result() and tokens_info_result() IPC callsItamar
These IPC calls are used in the communication with the language server to fetch semantic information about the tokens in a code document.
2022-01-15LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServersin-ack
This change unfortunately cannot be atomically made without a single commit changing everything. Most of the important changes are in LibIPC/Connection.cpp, LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp. The notable changes are: - IPCCompiler now generates the decode and decode_message functions such that they take a Core::Stream::LocalSocket instead of the socket fd. - IPC::Decoder now uses the receive_fd method of LocalSocket instead of doing system calls directly on the fd. - IPC::ConnectionBase and related classes now use the Stream API functions. - IPC::ServerConnection no longer constructs the socket itself; instead, a convenience macro, IPC_CLIENT_CONNECTION, is used in place of C_OBJECT and will generate a static try_create factory function for the ServerConnection subclass. The subclass is now responsible for passing the socket constructed in this function to its ServerConnection base; the socket is passed as the first argument to the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before any other arguments. - The functionality regarding taking over sockets from SystemServer has been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket implementation of this functionality hasn't been deleted due to my intention of removing this class in the near future and to reduce noise on this (already quite noisy) PR.
2022-01-07Everywhere: Fix many spelling errorsmjz19910
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-07-04CppLanguageServer: Add "get_parameters_hint" capabilityItamar
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-06-25HackStudio: Add LanguageClient::Language() getterItamar
2021-06-23HackStudio: Make TODO entries clickableFederico Guerinoni
Now you can click a TODO entry to set focus on that position of that file.
2021-06-23LanguageServers: Add function to collect TODO entries in a documentFederico Guerinoni
2021-05-23LibIPC: Remove unnecessary IPC::ServerConnection::handshake()Andreas Kling
This is no longer used by any of our IPC pairs.
2021-05-23HackStudio: Greet language servers asynchronouslyAndreas Kling
There's no need to wait for a response after we've sent the project path to a newly connected language server.
2021-05-16HackStudio+CppLanguageServer: Remove lexer-based autocomplete engineItamar
The parser-based autocomplete engine is at a point where it's stable enough that I don't think there's a need for the lexer-based alternative anymore.
2021-05-03Userland: Update IPC calls to use proxiesGunnar Beutner
This updates all existing code to use the auto-generated client methods instead of post_message/send_sync.
2021-05-03Userland: Change IPC funcs to use plain arguments instead of a structGunnar Beutner
Instead of having a single overloaded handle method each method gets its own unique method name now.
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