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]`.
426 lines
15 KiB
Text
426 lines
15 KiB
Text
{"textDocument": {"uri": "file:///completionOption.lean"},
|
|
"position": {"line": 1, "character": 17}}
|
|
{"items":
|
|
[{"label": "format.unicode",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}},
|
|
"newText": "format.unicode",
|
|
"insert":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}}},
|
|
"detail": "(true), unicode characters",
|
|
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]},
|
|
{"label": "format.width",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}},
|
|
"newText": "format.width",
|
|
"insert":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}}},
|
|
"detail": "(120), indentation",
|
|
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]},
|
|
{"label": "format.inputWidth",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}},
|
|
"newText": "format.inputWidth",
|
|
"insert":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}}},
|
|
"detail": "(100), ideal input width",
|
|
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]},
|
|
{"label": "trace.PrettyPrinter.format.input",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}},
|
|
"newText": "trace.PrettyPrinter.format.input",
|
|
"insert":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]},
|
|
{"label": "trace.PrettyPrinter.format",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}},
|
|
"newText": "trace.PrettyPrinter.format",
|
|
"insert":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]},
|
|
{"label": "format.indent",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}},
|
|
"newText": "format.indent",
|
|
"insert":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}}},
|
|
"detail": "(2), indentation",
|
|
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]},
|
|
{"label": "trace.PrettyPrinter.format.backtrack",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}},
|
|
"newText": "trace.PrettyPrinter.format.backtrack",
|
|
"insert":
|
|
{"start": {"line": 1, "character": 11},
|
|
"end": {"line": 1, "character": 17}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///completionOption.lean"},
|
|
"position": {"line": 4, "character": 20}}
|
|
{"items":
|
|
[{"label": "format.inputWidth",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 4, "character": 11},
|
|
"end": {"line": 4, "character": 20}},
|
|
"newText": "format.inputWidth",
|
|
"insert":
|
|
{"start": {"line": 4, "character": 11},
|
|
"end": {"line": 4, "character": 20}}},
|
|
"detail": "(100), ideal input width",
|
|
"data": ["«external:file:///completionOption.lean»", 4, 20, 0]},
|
|
{"label": "trace.PrettyPrinter.format.input",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 4, "character": 11},
|
|
"end": {"line": 4, "character": 20}},
|
|
"newText": "trace.PrettyPrinter.format.input",
|
|
"insert":
|
|
{"start": {"line": 4, "character": 11},
|
|
"end": {"line": 4, "character": 20}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 4, 20, 0]},
|
|
{"label": "format.indent",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 4, "character": 11},
|
|
"end": {"line": 4, "character": 20}},
|
|
"newText": "format.indent",
|
|
"insert":
|
|
{"start": {"line": 4, "character": 11},
|
|
"end": {"line": 4, "character": 20}}},
|
|
"detail": "(2), indentation",
|
|
"data": ["«external:file:///completionOption.lean»", 4, 20, 0]}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///completionOption.lean"},
|
|
"position": {"line": 7, "character": 23}}
|
|
{"items":
|
|
[{"label": "trace.Compiler.specialize.candidate",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 7, "character": 11},
|
|
"end": {"line": 7, "character": 23}},
|
|
"newText": "trace.Compiler.specialize.candidate",
|
|
"insert":
|
|
{"start": {"line": 7, "character": 11},
|
|
"end": {"line": 7, "character": 23}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 7, 23, 0]},
|
|
{"label": "trace.pp.analyze.error",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 7, "character": 11},
|
|
"end": {"line": 7, "character": 23}},
|
|
"newText": "trace.pp.analyze.error",
|
|
"insert":
|
|
{"start": {"line": 7, "character": 11},
|
|
"end": {"line": 7, "character": 23}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 7, 23, 0]},
|
|
{"label": "trace.pp.analyze",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 7, "character": 11},
|
|
"end": {"line": 7, "character": 23}},
|
|
"newText": "trace.pp.analyze",
|
|
"insert":
|
|
{"start": {"line": 7, "character": 11},
|
|
"end": {"line": 7, "character": 23}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 7, 23, 0]},
|
|
{"label": "trace.pp.analyze.tryUnify",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 7, "character": 11},
|
|
"end": {"line": 7, "character": 23}},
|
|
"newText": "trace.pp.analyze.tryUnify",
|
|
"insert":
|
|
{"start": {"line": 7, "character": 11},
|
|
"end": {"line": 7, "character": 23}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 7, 23, 0]},
|
|
{"label": "trace.pp.analyze.annotate",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 7, "character": 11},
|
|
"end": {"line": 7, "character": 23}},
|
|
"newText": "trace.pp.analyze.annotate",
|
|
"insert":
|
|
{"start": {"line": 7, "character": 11},
|
|
"end": {"line": 7, "character": 23}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 7, 23, 0]}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///completionOption.lean"},
|
|
"position": {"line": 10, "character": 27}}
|
|
{"items":
|
|
[{"label": "trace.pp.analyze.error",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 10, "character": 11},
|
|
"end": {"line": 10, "character": 27}},
|
|
"newText": "trace.pp.analyze.error",
|
|
"insert":
|
|
{"start": {"line": 10, "character": 11},
|
|
"end": {"line": 10, "character": 27}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 10, 27, 0]},
|
|
{"label": "trace.pp.analyze",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 10, "character": 11},
|
|
"end": {"line": 10, "character": 27}},
|
|
"newText": "trace.pp.analyze",
|
|
"insert":
|
|
{"start": {"line": 10, "character": 11},
|
|
"end": {"line": 10, "character": 27}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 10, 27, 0]},
|
|
{"label": "trace.pp.analyze.tryUnify",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 10, "character": 11},
|
|
"end": {"line": 10, "character": 27}},
|
|
"newText": "trace.pp.analyze.tryUnify",
|
|
"insert":
|
|
{"start": {"line": 10, "character": 11},
|
|
"end": {"line": 10, "character": 27}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 10, 27, 0]},
|
|
{"label": "trace.pp.analyze.annotate",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 10, "character": 11},
|
|
"end": {"line": 10, "character": 27}},
|
|
"newText": "trace.pp.analyze.annotate",
|
|
"insert":
|
|
{"start": {"line": 10, "character": 11},
|
|
"end": {"line": 10, "character": 27}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 10, 27, 0]}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///completionOption.lean"},
|
|
"position": {"line": 13, "character": 17}}
|
|
{"items":
|
|
[{"label": "format.unicode",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}},
|
|
"newText": "format.unicode",
|
|
"insert":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}}},
|
|
"detail": "(true), unicode characters",
|
|
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]},
|
|
{"label": "format.width",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}},
|
|
"newText": "format.width",
|
|
"insert":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}}},
|
|
"detail": "(120), indentation",
|
|
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]},
|
|
{"label": "format.inputWidth",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}},
|
|
"newText": "format.inputWidth",
|
|
"insert":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}}},
|
|
"detail": "(100), ideal input width",
|
|
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]},
|
|
{"label": "trace.PrettyPrinter.format.input",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}},
|
|
"newText": "trace.PrettyPrinter.format.input",
|
|
"insert":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]},
|
|
{"label": "trace.PrettyPrinter.format",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}},
|
|
"newText": "trace.PrettyPrinter.format",
|
|
"insert":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]},
|
|
{"label": "format.indent",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}},
|
|
"newText": "format.indent",
|
|
"insert":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}}},
|
|
"detail": "(2), indentation",
|
|
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]},
|
|
{"label": "trace.PrettyPrinter.format.backtrack",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}},
|
|
"newText": "trace.PrettyPrinter.format.backtrack",
|
|
"insert":
|
|
{"start": {"line": 13, "character": 11},
|
|
"end": {"line": 13, "character": 17}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]}],
|
|
"isIncomplete": false}
|
|
{"textDocument": {"uri": "file:///completionOption.lean"},
|
|
"position": {"line": 16, "character": 18}}
|
|
{"items":
|
|
[{"label": "format.unicode",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 16, "character": 11},
|
|
"end": {"line": 16, "character": 18}},
|
|
"newText": "format.unicode",
|
|
"insert":
|
|
{"start": {"line": 16, "character": 11},
|
|
"end": {"line": 16, "character": 18}}},
|
|
"detail": "(true), unicode characters",
|
|
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]},
|
|
{"label": "format.width",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 16, "character": 11},
|
|
"end": {"line": 16, "character": 18}},
|
|
"newText": "format.width",
|
|
"insert":
|
|
{"start": {"line": 16, "character": 11},
|
|
"end": {"line": 16, "character": 18}}},
|
|
"detail": "(120), indentation",
|
|
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]},
|
|
{"label": "format.inputWidth",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 16, "character": 11},
|
|
"end": {"line": 16, "character": 18}},
|
|
"newText": "format.inputWidth",
|
|
"insert":
|
|
{"start": {"line": 16, "character": 11},
|
|
"end": {"line": 16, "character": 18}}},
|
|
"detail": "(100), ideal input width",
|
|
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]},
|
|
{"label": "trace.PrettyPrinter.format.input",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 16, "character": 11},
|
|
"end": {"line": 16, "character": 18}},
|
|
"newText": "trace.PrettyPrinter.format.input",
|
|
"insert":
|
|
{"start": {"line": 16, "character": 11},
|
|
"end": {"line": 16, "character": 18}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]},
|
|
{"label": "format.indent",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 16, "character": 11},
|
|
"end": {"line": 16, "character": 18}},
|
|
"newText": "format.indent",
|
|
"insert":
|
|
{"start": {"line": 16, "character": 11},
|
|
"end": {"line": 16, "character": 18}}},
|
|
"detail": "(2), indentation",
|
|
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]},
|
|
{"label": "trace.PrettyPrinter.format.backtrack",
|
|
"kind": 10,
|
|
"edit":
|
|
{"replace":
|
|
{"start": {"line": 16, "character": 11},
|
|
"end": {"line": 16, "character": 18}},
|
|
"newText": "trace.PrettyPrinter.format.backtrack",
|
|
"insert":
|
|
{"start": {"line": 16, "character": 11},
|
|
"end": {"line": 16, "character": 18}}},
|
|
"detail":
|
|
"(false), enable/disable tracing for the given module and submodules",
|
|
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]}],
|
|
"isIncomplete": false}
|