Skip to content

Commit

Permalink
Merge e0f94fa into b8e0c0e
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrinberg authored May 14, 2024
2 parents b8e0c0e + e0f94fa commit c90e4ee
Showing 1 changed file with 218 additions and 119 deletions.
337 changes: 218 additions & 119 deletions ocaml-lsp-server/test/e2e/__tests__/textDocument-documentSymbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,65 +44,102 @@ describe("textDocument/documentSymbol", () => {

let result = await query();

expect(result).toMatchObject([
{
kind: 2,
location: {
range: {
end: { character: 3, line: 6 },
start: { character: 0, line: 3 },
expect(result).toMatchInlineSnapshot(`
Array [
Object {
"deprecated": false,
"kind": 2,
"location": Object {
"range": Object {
"end": Object {
"character": 3,
"line": 6,
},
"start": Object {
"character": 0,
"line": 3,
},
},
"uri": "file:///test.ml",
},
uri: "file:///test.ml",
"name": "M",
},
name: "M",
},
{
containerName: "M",
kind: 12,
location: {
range: {
end: { character: 12, line: 5 },
start: { character: 2, line: 5 },
Object {
"containerName": "M",
"deprecated": false,
"kind": 12,
"location": Object {
"range": Object {
"end": Object {
"character": 12,
"line": 5,
},
"start": Object {
"character": 2,
"line": 5,
},
},
"uri": "file:///test.ml",
},
uri: "file:///test.ml",
"name": "n",
},
name: "n",
},
{
containerName: "M",
kind: 12,
location: {
range: {
end: { character: 19, line: 4 },
start: { character: 2, line: 4 },
Object {
"containerName": "M",
"deprecated": false,
"kind": 12,
"location": Object {
"range": Object {
"end": Object {
"character": 19,
"line": 4,
},
"start": Object {
"character": 2,
"line": 4,
},
},
"uri": "file:///test.ml",
},
uri: "file:///test.ml",
"name": "m",
},
name: "m",
},
{
kind: 12,
location: {
range: {
end: { character: 20, line: 1 },
start: { character: 0, line: 1 },
Object {
"deprecated": false,
"kind": 12,
"location": Object {
"range": Object {
"end": Object {
"character": 20,
"line": 1,
},
"start": Object {
"character": 0,
"line": 1,
},
},
"uri": "file:///test.ml",
},
uri: "file:///test.ml",
"name": "string",
},
name: "string",
},
{
kind: 12,
location: {
range: {
end: { character: 12, line: 0 },
start: { character: 0, line: 0 },
Object {
"deprecated": false,
"kind": 12,
"location": Object {
"range": Object {
"end": Object {
"character": 12,
"line": 0,
},
"start": Object {
"character": 0,
"line": 0,
},
},
"uri": "file:///test.ml",
},
uri: "file:///test.ml",
"name": "num",
},
name: "num",
},
]);
]
`);
});

it("returns a hierarchy of symbols", async () => {
Expand All @@ -128,82 +165,144 @@ describe("textDocument/documentSymbol", () => {

let result = await query();

expect(result).toMatchObject([
{
children: [
{
children: [],
deprecated: false,
detail: "int",
kind: 12,
name: "n",
range: {
end: { character: 12, line: 5 },
start: { character: 2, line: 5 },
},
selectionRange: {
end: { character: 12, line: 5 },
start: { character: 2, line: 5 },
expect(result).toMatchInlineSnapshot(`
Array [
Object {
"children": Array [
Object {
"children": Array [],
"deprecated": false,
"detail": "int",
"kind": 12,
"name": "n",
"range": Object {
"end": Object {
"character": 12,
"line": 5,
},
"start": Object {
"character": 2,
"line": 5,
},
},
"selectionRange": Object {
"end": Object {
"character": 12,
"line": 5,
},
"start": Object {
"character": 2,
"line": 5,
},
},
},
Object {
"children": Array [],
"deprecated": false,
"detail": "int -> int -> int",
"kind": 12,
"name": "m",
"range": Object {
"end": Object {
"character": 19,
"line": 4,
},
"start": Object {
"character": 2,
"line": 4,
},
},
"selectionRange": Object {
"end": Object {
"character": 19,
"line": 4,
},
"start": Object {
"character": 2,
"line": 4,
},
},
},
],
"deprecated": false,
"kind": 2,
"name": "M",
"range": Object {
"end": Object {
"character": 3,
"line": 6,
},
"start": Object {
"character": 0,
"line": 3,
},
},
{
children: [],
deprecated: false,
detail: "int -> int -> int",
kind: 12,
name: "m",
range: {
end: { character: 19, line: 4 },
start: { character: 2, line: 4 },
},
selectionRange: {
end: { character: 19, line: 4 },
start: { character: 2, line: 4 },
"selectionRange": Object {
"end": Object {
"character": 3,
"line": 6,
},
"start": Object {
"character": 0,
"line": 3,
},
},
],
deprecated: false,
kind: 2,
name: "M",
range: {
end: { character: 3, line: 6 },
start: { character: 0, line: 3 },
},
selectionRange: {
end: { character: 3, line: 6 },
start: { character: 0, line: 3 },
},
},
{
children: [],
deprecated: false,
detail: "string",
kind: 12,
name: "string",
range: {
end: { character: 20, line: 1 },
start: { character: 0, line: 1 },
},
selectionRange: {
end: { character: 20, line: 1 },
start: { character: 0, line: 1 },
},
},
{
children: [],
deprecated: false,
detail: "int",
kind: 12,
name: "num",
range: {
end: { character: 12, line: 0 },
start: { character: 0, line: 0 },
Object {
"children": Array [],
"deprecated": false,
"detail": "string",
"kind": 12,
"name": "string",
"range": Object {
"end": Object {
"character": 20,
"line": 1,
},
"start": Object {
"character": 0,
"line": 1,
},
},
"selectionRange": Object {
"end": Object {
"character": 20,
"line": 1,
},
"start": Object {
"character": 0,
"line": 1,
},
},
},
selectionRange: {
end: { character: 12, line: 0 },
start: { character: 0, line: 0 },
Object {
"children": Array [],
"deprecated": false,
"detail": "int",
"kind": 12,
"name": "num",
"range": Object {
"end": Object {
"character": 12,
"line": 0,
},
"start": Object {
"character": 0,
"line": 0,
},
},
"selectionRange": Object {
"end": Object {
"character": 12,
"line": 0,
},
"start": Object {
"character": 0,
"line": 0,
},
},
},
},
]);
]
`);
});
});

0 comments on commit c90e4ee

Please sign in to comment.