summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio
AgeCommit message (Collapse)Author
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-06LanguageServers: Support calling SetFileContent with not-yet open filesItamar
Also, use dbgln_if
2021-03-06LanguageServers: Tweak FileDB APIItamar
- FileDB::get() now returns nullptr if the file is not in the FileDB - Added FileDB::get_or_create_from_filesystem() - Added FileDB::add() version that receives that file's content as a parameter
2021-03-06HackStudio: Add ProjectFile::create_if_neededItamar
2021-03-06HackStudio: Create Language enum from file extension or language nameItamar
2021-03-06HackStudio: Remove redundant null check when creating a new project fileItamar
Project::get_file returns a NonNullRefPtr
2021-03-06HackStudio: Make sure project files are created with an absolute pathItamar
This fixes an issue were "Find in Files" would not use the up-to-date content of a file with unsaved changes. The issue existed because 'FindInFilesWidget' uses Project::for_each_text_file, which retrieves files by their absolute path. However, when a file is opened in an Editor, it is created with a relative path. This caused us to store two ProjectFile objects that refer to the same file - one with a relative path and one with an absolute path.
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-06LanguageServers/Cpp: Allow the creation of DocumentData objects to failItamar
This fixes langauge-server crashes when trying to parse non-existant header files, such as #include <new>. Closes #5569.
2021-03-04HackStudio/LanguageServers: Move some components out of CppAnotherTest
This makes them available for use by other language servers. Also as a bonus, update the Shell language server to discover some symbols and add go-to-definition functionality :^)
2021-03-03HackStudio: Allow multi-selection in project view treeBui Quang Minh
2021-03-02HackStudio: Implement removing file from diskBui Quang Minh
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-27LibVT: Put TerminalWidget in the VT namespace :^)Andreas Kling
2021-02-27HackStudio: Support searching symbol declarations in the LocatorItamar
The Locator now keeps a cache of the declared symbol in a document. The language client updates that cache whenever it gets an update from the language server about declared symbols. This allows searching for symbol declarations in the Locator, in addition to file names. Closes #5478
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-27LanguageServers/Cpp: Add type to DeclarationsItamar
2021-02-27LanguageServers: Add ProjectLoaction, Declaration types and use in IPCItamar
With this we can avoid passing (name, line, column) tuples in many different places.
2021-02-26LanguageServers/Cpp: Don't VERIFY that a file could be foundItamar
... when creating a new DocumentData
2021-02-26HackStudio: Set correct icons, text and location in menusthankyouverycool
Adds correct icon to New Project, moves Wrapping Mode to more traditional View, and truncates overly verbose Project entries
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-23HackStudio: Fix a misuse of dbgln() intended as dbgln_if()AnotherTest
This currently works accidentally, just because there's an overload for `dbgln<bool>(...)` - it just bypasses the compiletime checks.
2021-02-22HackStudio: Fix opened files appearing empty (#5480)Ivan Hansgaard Hansen
When files where placed in outside of the project root, they would appear empty because the label in the tree would differ from the actual file path relative to the root. Fixes #5471.
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-20LibCpp: Store filename in ASTNodesItamar
As part of the position information, we now also store the filename the ASTNode belongs to.
2021-02-20HackStudio: Always use relative paths when opening project filesItamar
2021-02-20HackStudio: Display identifiers as clickableItamar
This extends the "navigate to include" feature to also display identifiers as clickable when they're hovered over while left control is pressed.
2021-02-20LibGUI: Swap order of InputBox value and parent window argsLinus Groh
This is now consistent with the other dialog classes.
2021-02-19LibGUI: Remove GUI::FilePicker::file_exists()Andreas Kling
I have no idea why this existed but everyone should just use Core::File::exists() instead. :^)
2021-02-13LanguageServers/cpp: Use parser-based autocomplete engine by defaultItamar
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-13LanguageServers/Cpp: Handle autocomplete request on an empty lineItamar
2021-02-13HackStudio: Set icon for 'make is not available' notificationItamar
2021-02-13HackStudio: Project templates and New Project dialogNick Vella
This commit adds a simple project template system to HackStudio, as well as a pretty New Project dialog, inspired by early VS.NET and MS Office.
2021-02-10LanguageServers/Cpp: Autocomplete declarations from included headersItamar
We now also look at the available declarations from included header files when autocompleting names. Additionally, you can now request autocomplete on an empty token, which brings up all available names, starting from the inner-most scope.
2021-02-10LanguageServers/Cpp: Autocomplete function and struct/class namesItamar
2021-02-10HackStudio: Show notification if 'make' is not availableItamar
We previously popped a MessageBox for this, but a notification is less disruptive.
2021-02-08LanguageServers/Cpp: ParserAutoComplete engine inspects header filesItamar
... and performs preprocessing on the source code before parsing. To support this, we are now able to keep track of multiple files in the autocomplete engine. We re-parse a file whenever it is edited.
2021-02-08LanguageServers/Cpp: Use FileDB and AutoCompleteEngine base classItamar
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-08Everywhere: Replace dbgln<flag>(...) with dbgln_if(flag, ...)AnotherTest
Replacement made by `find Kernel Userland -name '*.h' -o -name '*.cpp' | sed -i -Ee 's/dbgln\b<(\w+)>\(/dbgln_if(\1, /g'`
2021-02-08Everywhere: Fix weird includesBen Wiederhake
2021-02-08Everywhere: Add semantically-missing includesBen Wiederhake
For example, FindInFilesWidget.h mentions GUI::TableView, but did not include it. On the other hand, all source files that include FindInFilesWidget.h also include TableView.h, so the issue is only cosmetical.
2021-02-07Shell: Move Shell syntax highlighter LibShellAndreas Kling
2021-02-07LibSyntax+LibGUI+LibJS: Move JS syntax highlighter to LibJSAndreas Kling
This is a little bit messy but the basic idea is: Syntax::Highlighter now has a Syntax::HighlighterClient to talk to the outside world. It mostly communicates in LibGUI primitives that are available in headers, so inlineable. GUI::TextEditor inherits from Syntax::HighlighterClient. This let us to move GUI::JSSyntaxHighlighter to JS::SyntaxHighlighter and remove LibGUI's dependency on LibJS.
2021-02-07LibSyntax: Move GUI::Highlighter to Syntax::Highlighter in LibSyntaxAndreas Kling
This is a move towards dropping more LibGUI dependencies.
2021-02-07LibGUI+LibCpp: Move C++ syntax highlighter to LibCppAndreas Kling
This makes LibGUI not depend on LibCpp.
2021-02-03TextEditor: Implement word wrappingZac
Add a new wrapping mode to the TextEditor that will wrap lines at the spaces between words. Replace the previous menubar checkbox 'Wrapping Mode' in HackStudio and the TextEditor with an exclusive submenu which allows switching between 'No wrapping', 'Wrap anywhere' and 'Wrap at words'. 'Wrap anywhere' (the new 'Wrap lines') is still the default mode. Setting the wrapping mode in the constructors of the TextEditorWidget and HackStudio has been removed, it is now set when constructing the menubar actions.
2021-02-03HackStudio: do not open empty directories as fileMatteo Sozzi
When _double clicking_ or _right click > Open_ in the tree view, the selected directory, if empty, was open in the editor section as file.