[Mlir-commits] [mlir] bb97959 - [mlir-lsp-server] Document the features provided by the language server

River Riddle llvmlistbot at llvm.org
Thu Jun 10 11:03:57 PDT 2021


Author: River Riddle
Date: 2021-06-10T10:58:39-07:00
New Revision: bb97959949ff68aa7e001bab2be1b5be4d6d389a

URL: https://github.com/llvm/llvm-project/commit/bb97959949ff68aa7e001bab2be1b5be4d6d389a
DIFF: https://github.com/llvm/llvm-project/commit/bb97959949ff68aa7e001bab2be1b5be4d6d389a.diff

LOG: [mlir-lsp-server] Document the features provided by the language server

This revision adds focused documentation on each of the individual features of the server, with images showcasing how they look in vscode.

Differential Revision: https://reviews.llvm.org/D103942

Added: 
    

Modified: 
    mlir/docs/Tools/MLIRLSP.md

Removed: 
    


################################################################################
diff  --git a/mlir/docs/Tools/MLIRLSP.md b/mlir/docs/Tools/MLIRLSP.md
index de6c94e849436..0b7f79ed30ecc 100644
--- a/mlir/docs/Tools/MLIRLSP.md
+++ b/mlir/docs/Tools/MLIRLSP.md
@@ -36,10 +36,70 @@ int main(int argc, char **argv) {
   mlir::DialectRegistry registry;
   registerMyDialects(registry);
   registerMyPasses();
-  return failed(mlir::MlirLspServerMain(argc, argv, registry));
+  return mlir::failed(mlir::MlirLspServerMain(argc, argv, registry));
 }
 ```
 
+### Features
+
+This section details a few of the features that the MLIR language server
+provides. The screenshots are shown in [VSCode](https://code.visualstudio.com/),
+but the exact feature set available will depend on your editor client.
+
+#### Diagnostics
+
+The language server runs actively runs verification on the IR as you type,
+showing any generate diagnostics in-place.
+
+![IMG](/mlir-lsp-server/diagnostics.png)
+
+#### Cross-references
+
+Cross references allow for navigating the use/def chains of SSA values (i.e.
+operation results and block arguments), [Symbols](../SymbolsAndSymbolTables.md),
+and Blocks.
+
+##### Find definition
+
+Jump to the definition of the IR entity under the cursor. A few examples are
+shown below:
+
+*   SSA Values
+
+![SSA](/mlir-lsp-server/goto_def_ssa.gif)
+
+*   Symbol References
+
+![Symbols](/mlir-lsp-server/goto_def_symbol.gif)
+
+The definition of an operation will also take into account the source location
+attached, allowing for navigating into the source file that generated the
+operation.
+
+![External Locations](/mlir-lsp-server/goto_def_external.gif)
+
+##### Find references
+
+Show all references of the IR entity under the cursor.
+
+![IMG](/mlir-lsp-server/find_references.gif)
+
+#### Hover
+
+Hover over an IR entity to see more information about it. The exact information
+displayed is dependent on the type of IR entity under the cursor. For example,
+hovering over an `Operation` may show its generic format.
+
+![IMG](/mlir-lsp-server/hover.png)
+
+#### Navigation
+
+The language server will also inform the editor about the structure of symbol
+tables within the IR. This allows for jumping directly to the definition of a
+symbol, such as a `func`, within the file.
+
+![IMG](/mlir-lsp-server/navigation.gif)
+
 ### Design
 
 The design of `mlir-lsp-server` is largely comprised of three 
diff erent


        


More information about the Mlir-commits mailing list