redhat-developer / vscode-xml

Editing XML in Visual Studio Code made easy
Eclipse Public License 2.0
260 stars 81 forks source link

Provide `xml.symbols.maxItemsComputed` setting for outline #237

Closed angelozerr closed 4 years ago

angelozerr commented 4 years ago

In vscode, when you try to open a big JSON file which generates many symbols, the outline doesn't show the all symbols and you have this warning message:

image

It should be fine to do that in vscode-xml with the xml.maxItemsComputed with 5000 by default like JSON. It will avoid freezing vscode with a big XML file (the enable/disable settings that we have is too limited)

If you download for instance the big XML Schema https://github.com/redhat-developer/vscode-xml/files/4029276/AUTOSAR_00048.zip you open in vscode will see that vscode freeze when you open it and when you update it as soon as Outline is filled.

angelozerr commented 4 years ago

Here some helpful information with JSON:

LemMinx

See https://github.com/microsoft/vscode/blob/785eb0872a97f18775ca294fe2a4e4e35fc6a10e/extensions/json-language-features/server/src/jsonServerMain.ts#L447 (for getting this result limit settings) . We should do the similar logic in the XMLTextDocumentService#documentSymbols

See https://github.com/microsoft/vscode-json-languageservice/blob/5e62091ee8e84d898a9440b05540dbe9f07e86c8/src/services/jsonDocumentSymbols.ts#L102 We should do the similar code in XMLSymbolsProvider.

vscode-xml

The JSON language client intercepts the json/resultLimitReached notification and display the popup -> see https://github.com/microsoft/vscode/blob/45b2a7e10243677801dc9da34a464b1a15f5df57/extensions/json-language-features/client/src/jsonMain.ts#L52 and https://github.com/microsoft/vscode/blob/11c130357bcecfd0bfd9a5f3e4400b87f1836b52/extensions/json-language-features/client/src/jsonMain.ts#L287

We should do that (intercepts xml/resultLimitReached LSP notification) in vscode-xml