lean4-htt/tests/lean/interactive/errorExplanationInteractive.lean.expected.out
Marc Huisinga 7ba0ae1f72
feat: improve auto-completion performance (#10249)
This PR speeds up auto-completion by a factor of ~3.5x through various
performance improvements in the language server. On one machine, with
`import Mathlib`, completing `i` used to take 3200ms and now instead
yields a result in 920ms.

Specifically, the following improvements are made:
- The watchdog process no longer de-serializes and re-serializes most
messages from the file worker before passing them on to the user - a
fast partial de-serialization procedure is now used to determine whether
the message needs to be de-serialized in full or not.
- `escapePart` is optimized to perform better on ASCII strings that do
not need escaping.
- `Json.compress` is optimized to allocate fewer objects.
- A faster JSON compression specifically for completion responses is
implemented that skips allocating `Json` altogether.
- The JSON compression has been moved to the task where we convert a
request response to `Json` so that converting to a string won't block
the output task of the FileWorker and so the `Json` value is not marked
as multi-threaded when we compress is, which drastically increases the
cost of reference-counting.
- The JSON representation of the `data?` field of each completion item
is optimized.
- Both the completion kind and the set of completion tags for each
imported completion item is now cached.
- The filtering of duplicate completion items is optimized.

Other adjustments:
- `LT UInt8` and `LE UInt8` are moved to Prelude so that they can be
used in `Init.Meta` for the name part escaping fast path.
- `Array.usize` is exposed since it was marked as `@[simp]`.
2025-09-05 08:55:49 +00:00

156 lines
5.7 KiB
Text

{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
"position": {"line": 28, "character": 30}}
{"items":
[{"label": "testPkg.foo2",
"kind": 10,
"edit":
{"replace":
{"start": {"line": 28, "character": 23},
"end": {"line": 28, "character": 30}},
"newText": "testPkg.foo2",
"insert":
{"start": {"line": 28, "character": 23},
"end": {"line": 28, "character": 30}}},
"documentation": {"value": "(error) Error 2", "kind": "markdown"},
"detail": "error name",
"data": ["«external:file:///errorExplanationInteractive.lean»", 28, 30, 0]},
{"label": "testPkg.bar",
"kind": 10,
"edit":
{"replace":
{"start": {"line": 28, "character": 23},
"end": {"line": 28, "character": 30}},
"newText": "testPkg.bar",
"insert":
{"start": {"line": 28, "character": 23},
"end": {"line": 28, "character": 30}}},
"documentation": {"value": "(error) Error 0", "kind": "markdown"},
"detail": "error name",
"data": ["«external:file:///errorExplanationInteractive.lean»", 28, 30, 0]},
{"label": "testPkg.foo1",
"kind": 10,
"edit":
{"replace":
{"start": {"line": 28, "character": 23},
"end": {"line": 28, "character": 30}},
"newText": "testPkg.foo1",
"insert":
{"start": {"line": 28, "character": 23},
"end": {"line": 28, "character": 30}}},
"documentation": {"value": "(error) Error 1", "kind": "markdown"},
"detail": "error name",
"data": ["«external:file:///errorExplanationInteractive.lean»", 28, 30, 0]}],
"isIncomplete": false}
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
"position": {"line": 30, "character": 31}}
{"items":
[{"label": "testPkg.foo2",
"kind": 10,
"edit":
{"replace":
{"start": {"line": 30, "character": 23},
"end": {"line": 30, "character": 31}},
"newText": "testPkg.foo2",
"insert":
{"start": {"line": 30, "character": 23},
"end": {"line": 30, "character": 31}}},
"documentation": {"value": "(error) Error 2", "kind": "markdown"},
"detail": "error name",
"data": ["«external:file:///errorExplanationInteractive.lean»", 30, 31, 0]},
{"label": "testPkg.bar",
"kind": 10,
"edit":
{"replace":
{"start": {"line": 30, "character": 23},
"end": {"line": 30, "character": 31}},
"newText": "testPkg.bar",
"insert":
{"start": {"line": 30, "character": 23},
"end": {"line": 30, "character": 31}}},
"documentation": {"value": "(error) Error 0", "kind": "markdown"},
"detail": "error name",
"data": ["«external:file:///errorExplanationInteractive.lean»", 30, 31, 0]},
{"label": "testPkg.foo1",
"kind": 10,
"edit":
{"replace":
{"start": {"line": 30, "character": 23},
"end": {"line": 30, "character": 31}},
"newText": "testPkg.foo1",
"insert":
{"start": {"line": 30, "character": 23},
"end": {"line": 30, "character": 31}}},
"documentation": {"value": "(error) Error 1", "kind": "markdown"},
"detail": "error name",
"data": ["«external:file:///errorExplanationInteractive.lean»", 30, 31, 0]}],
"isIncomplete": false}
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
"position": {"line": 32, "character": 32}}
{"items":
[{"label": "testPkg.foo2",
"kind": 10,
"edit":
{"replace":
{"start": {"line": 32, "character": 23},
"end": {"line": 32, "character": 32}},
"newText": "testPkg.foo2",
"insert":
{"start": {"line": 32, "character": 23},
"end": {"line": 32, "character": 32}}},
"documentation": {"value": "(error) Error 2", "kind": "markdown"},
"detail": "error name",
"data": ["«external:file:///errorExplanationInteractive.lean»", 32, 32, 0]},
{"label": "testPkg.foo1",
"kind": 10,
"edit":
{"replace":
{"start": {"line": 32, "character": 23},
"end": {"line": 32, "character": 32}},
"newText": "testPkg.foo1",
"insert":
{"start": {"line": 32, "character": 23},
"end": {"line": 32, "character": 32}}},
"documentation": {"value": "(error) Error 1", "kind": "markdown"},
"detail": "error name",
"data": ["«external:file:///errorExplanationInteractive.lean»", 32, 32, 0]}],
"isIncomplete": false}
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
"position": {"line": 34, "character": 32}}
{"items":
[{"label": "testPkg.foo2",
"kind": 10,
"edit":
{"replace":
{"start": {"line": 34, "character": 23},
"end": {"line": 34, "character": 32}},
"newText": "testPkg.foo2",
"insert":
{"start": {"line": 34, "character": 23},
"end": {"line": 34, "character": 32}}},
"documentation": {"value": "(error) Error 2", "kind": "markdown"},
"detail": "error name",
"data": ["«external:file:///errorExplanationInteractive.lean»", 34, 32, 0]},
{"label": "testPkg.foo1",
"kind": 10,
"edit":
{"replace":
{"start": {"line": 34, "character": 23},
"end": {"line": 34, "character": 32}},
"newText": "testPkg.foo1",
"insert":
{"start": {"line": 34, "character": 23},
"end": {"line": 34, "character": 32}}},
"documentation": {"value": "(error) Error 1", "kind": "markdown"},
"detail": "error name",
"data": ["«external:file:///errorExplanationInteractive.lean»", 34, 32, 0]}],
"isIncomplete": false}
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
"position": {"line": 37, "character": 31}}
{"range":
{"start": {"line": 37, "character": 23}, "end": {"line": 37, "character": 35}},
"contents": {"value": "(error) Error 2", "kind": "markdown"}}
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
"position": {"line": 39, "character": 31}}
{"range":
{"start": {"line": 39, "character": 23}, "end": {"line": 39, "character": 35}},
"contents": {"value": "(error) Error 2", "kind": "markdown"}}