Skip to content

Commit

Permalink
test: update to show related information (#906)
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg authored Nov 5, 2022
1 parent b42a743 commit cbf272b
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
56 changes: 53 additions & 3 deletions ocaml-lsp-server/test/e2e/__tests__/textDocument-diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@ describe("textDocument/diagnostics", () => {
"line": 0,
},
},
"relatedInformation": Array [
Object {
"location": Object {
"range": Object {
"end": Object {
"character": 4,
"line": 0,
},
"start": Object {
"character": 3,
"line": 0,
},
},
"uri": "file:///test.ml",
},
"message": "String literal begins here",
},
],
"severity": 1,
"source": "ocamllsp",
},
Expand Down Expand Up @@ -165,9 +183,7 @@ describe("textDocument/diagnostics", () => {
is not included in
sig val x : unit end
Values do not match: val x : int is not included in val x : unit
The type int is not compatible with the type unit
File \\"test.ml\\", line 2, characters 2-14: Expected declaration
File \\"test.ml\\", line 4, characters 6-7: Actual declaration",
The type int is not compatible with the type unit",
"range": Object {
"end": Object {
"character": 3,
Expand All @@ -178,6 +194,40 @@ describe("textDocument/diagnostics", () => {
"line": 2,
},
},
"relatedInformation": Array [
Object {
"location": Object {
"range": Object {
"end": Object {
"character": 14,
"line": 2,
},
"start": Object {
"character": 2,
"line": 2,
},
},
"uri": "file:///test.ml",
},
"message": "Expected declaration",
},
Object {
"location": Object {
"range": Object {
"end": Object {
"character": 7,
"line": 4,
},
"start": Object {
"character": 6,
"line": 4,
},
},
"uri": "file:///test.ml",
},
"message": "Actual declaration",
},
],
"severity": 1,
"source": "ocamllsp",
},
Expand Down
8 changes: 7 additions & 1 deletion ocaml-lsp-server/test/e2e/src/LanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ export const startAndInitialize = async (
processId: process.pid,
rootUri: toURI(path.join(__dirname, "..")),
workspaceFolders: [],
capabilities: {},
capabilities: {
textDocument: {
publishDiagnostics: {
relatedInformation: true,
},
},
},
...initializeParameters,
};

Expand Down

0 comments on commit cbf272b

Please sign in to comment.