Skip to content

Integrate Language Server Protocol functionality into Code Windows

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 05 Aug 23:46
· 1012 commits to master since this release
1edc5ba

This release incorporates the changes by @falko17 from pull request #751.
Builds for Windows and Linux are available below.

Details

This PR integrates LSP-based information and functionality into SEE's code windows. It is the third and final part of my master's thesis implementation.

This PR resolves #686 and it resolves #728.

LSP integration

The following Language Server features have been integrated into Code Windows1:

  • Semantic Tokens: Syntax highlighting has been implemented using the semantic tokens provided by the Language Server. These are "semantic" as they offer slightly more information than usual lexer-based syntax highlighting tools give us. For example, we can render static elements in italics as an additional modifier to their color.
  • Diagnostics are highlighted using the issue highlighting mechanism implemented in #369. Hovering over the corresponding diagnostic yields the message associated to it.
    • As part of this, a custom converter has been implemented that converts Markdown text to TextMeshPro rich text. This way, bold elements are rendered bold, monospace segments are rendered in a monospace font, etc. This is also used for the next item.
  • Hover information is shown to the user when they hover above an element in the code window. This most frequently consists of the rendered documentation for the hovered element.
  • Navigation features are available upon right click on any element in the code window. This opens a right click menu where the user can select from "Find references", "Go to declaration", "Go to definition", "Go to implementation", "Show supertypes", and "Show outgoing calls". Note that options are not shown if the Language Server does not support the respective navigation. Upon selecting any of these, a menu opens from which the user can select a target to jump to (unless there is only one option, in which case it will be opened immediately).
    • When holding down the Ctrl button and clicking on an element in the code window, it will jump to the definition of that element, as is customary in many IDEs.
  • Additionally, the bug behind the Call Hierarchy capability not working has been identified. It is due to a bug in the OmniSharp LSP library which has been reported to the upstream repository. A workaround has also been applied to SEE, so the capability works now.

Additional changes

  • Menu entries for all UI menus in SEE now use a char instead of a Sprite, where the character represents a FontAwesome codepoint, in accordance with our new icon system. This makes it much easier to use new icons compared to the old Sprite-based system.
  • In code windows, when navigating to a certain line (either from a code city block or from the LSP navigation), the line number is marked in red to indicate the target line.
  • The tooltip has been improved to be constrained to a maximum size while not becoming bigger than it has to. This effectively leads to soft wrap functionality for the Tooltip, making bigger Tooltips more likely to fit on the screen.
  • A timeout has been added to the DashboardRetriever. By default, it will fail a request after 5 seconds, but this is configurable in the editor.
  • A bug has been fixed that lead to menu entries not being removed properly if the menu is modified.
  • A ReferenceEqualityComparer class has been added from the .NET 5 source code.
  • The existing scanner infrastructure has been heavily refactored to support getting syntax highlighting information both from Antlr and LSP.
  • Where applicable, plain data classes have been converted to records for brevity.
  • Updated to Unity 2022.3.38f1.

See original pull request for details.

  1. Note that all of these features will only be used if the corresponding option in the LSP handler has been enabled.