Closed lpanebr closed 2 years ago
It's probably because the server has crashed before already, for a different reason.
If you enable logging (https://lsp.sublimetext.io/troubleshooting/#self-help-instructions) the log panel should tell you why but probably due to missing Java.
Let me check deeper...
Actually the Troubleshooting command doesn't really support the way how this server updates the command
. So its results can be mostly disregarded.
Can you try maybe adding a folder to the project and opening an xml file from that folder? Some servers really don't like when there are no folders in the workspace.
I've tried here on an M1 Mac with openjdk installed and it works fine, even with a single file opened without workspace folders. The log I get is only (apart from server communication):
LemMinX: Dec 08, 2021 11:56:51 org.eclipse.lemminx.logs.LogHelper initializeRootLogger()
Message: Log file could not be created, path not provided
Thanks for your quick reply! Just for good mesure I reinstalled the LemMinX addon, but still no success. 😞
I moved the file to a folder in the project:
{
"settings":
{
"LSP":
{
"LemMinX":
{
"enabled": true,
},
},
},
"folders":
[
{
"path": "/home/lpanebr/Desktop/xmlproject",
}
],
}
and the errors are still the same:
It seems like it finds the main dtd file but is not able to follow the other referenced files and modules:
I enabled the "log_server": ["panel"]
config to the LSP settings and got the following output:
:: --> LemMinX initialize(1): {'capabilities': {'workspace': {'workspaceEdit': {'failureHandling': 'abort', 'documentChanges': True}, 'applyEdit': True, 'configuration': True, 'symbol': {'tagSupport': {'valueSet': [1]}, 'dynamicRegistration': True, 'symbolKind': {'valueSet': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}, 'executeCommand': {}, 'workspaceFolders': True, 'didChangeConfiguration': {'dynamicRegistration': True}}, 'general': {'regularExpressions': {'engine': 'ECMAScript'}, 'markdown': {'parser': 'Python-Markdown', 'version': '3.2.2'}}, 'window': {'showMessage': {'messageActionItem': {'additionalPropertiesSupport': True}}, 'showDocument': {'support': True}, 'workDoneProgress': True}, 'textDocument': {'hover': {'contentFormat': ['markdown', 'plaintext'], 'dynamicRegistration': True}, 'publishDiagnostics': {'dataSupport': True, 'tagSupport': {'valueSet': [1, 2]}, 'codeDescriptionSupport': True, 'relatedInformation': True, 'versionSupport': True}, 'typeDefinition': {'linkSupport': True, 'dynamicRegistration': True}, 'codeAction': {'dataSupport': True, 'codeActionLiteralSupport': {'codeActionKind': {'valueSet': ['quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source.organizeImports']}}, 'dynamicRegistration': True, 'resolveSupport': {'properties': ['edit']}}, 'documentHighlight': {'dynamicRegistration': True}, 'formatting': {'dynamicRegistration': True}, 'rangeFormatting': {'dynamicRegistration': True}, 'signatureHelp': {'dynamicRegistration': True, 'signatureInformation': {'parameterInformation': {'labelOffsetSupport': True}, 'documentationFormat': ['markdown', 'plaintext']}}, 'codeLens': {'dynamicRegistration': True}, 'implementation': {'linkSupport': True, 'dynamicRegistration': True}, 'colorProvider': {'dynamicRegistration': True}, 'definition': {'linkSupport': True, 'dynamicRegistration': True}, 'selectionRange': {'dynamicRegistration': True}, 'synchronization': {'didSave': True, 'willSaveWaitUntil': True, 'dynamicRegistration': True, 'willSave': True}, 'references': {'dynamicRegistration': True}, 'completion': {'insertTextMode': 2, 'completionItem': {'tagSupport': {'valueSet': [1]}, 'insertTextModeSupport': {'valueSet': [2]}, 'snippetSupport': True, 'documentationFormat': ['markdown', 'plaintext'], 'labelDetailsSupport': True, 'deprecatedSupport': True, 'resolveSupport': {'properties': ['detail', 'documentation', 'additionalTextEdits']}}, 'dynamicRegistration': True, 'completionItemKind': {'valueSet': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]}}, 'documentSymbol': {'tagSupport': {'valueSet': [1]}, 'hierarchicalDocumentSymbolSupport': True, 'dynamicRegistration': True, 'symbolKind': {'valueSet': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}, 'rename': {'prepareSupport': True, 'dynamicRegistration': True}, 'declaration': {'linkSupport': True, 'dynamicRegistration': True}}}, 'clientInfo': {'version': '1.14.0', 'name': 'Sublime Text LSP'}, 'initializationOptions': {}, 'rootUri': 'file:///home/lpanebr/Desktop/xmlproject', 'processId': 977835, 'workspaceFolders': [{'uri': 'file:///home/lpanebr/Desktop/xmlproject', 'name': 'xmlproject'}], 'rootPath': '/home/lpanebr/Desktop/xmlproject'}
:: <<< LemMinX 1: {'capabilities': {'workspace': {'workspaceFolders': {'supported': True, 'changeNotifications': True}}, 'textDocumentSync': {'save': {}, 'change': {'syncKind': 2}, 'didOpen': {}, 'didClose': {}}, 'renameProvider': False, 'foldingRangeProvider': True, 'definitionProvider': False, 'documentHighlightProvider': False, 'hoverProvider': False, 'referencesProvider': False, 'typeDefinitionProvider': False, 'documentFormattingProvider': False, 'documentLinkProvider': {'resolveProvider': True}, 'linkedEditingRangeProvider': True, 'documentSymbolProvider': False, 'codeActionProvider': False, 'documentRangeFormattingProvider': False}}
:: -> LemMinX initialized: {}
:: -> LemMinX workspace/didChangeConfiguration: {'settings': {'xml': {'fileAssociations': [{'systemId': '/home/lpanebr/.cache/sublime-text/Package Storage/LSP-lemminx/cache/sublime/sublime-snippet.xsd', 'pattern': '**/*.sublime-snippet'}, {'systemId': '/home/lpanebr/.cache/sublime-text/Package Storage/LSP-lemminx/cache/sublime/tmPreferences.xsd', 'pattern': '**/*.tmPreferences'}, {'systemId': '/home/lpanebr/.cache/sublime-text/Package Storage/LSP-lemminx/cache/sublime/tmPreferences.xsd', 'pattern': '**/*.hidden-tmPreferences'}, {'systemId': '/home/lpanebr/.cache/sublime-text/Package Storage/LSP-lemminx/cache/sublime/tmTheme.xsd', 'pattern': '**/*.tmTheme'}, {'systemId': '/home/lpanebr/.cache/sublime-text/Package Storage/LSP-lemminx/cache/sublime/tmTheme.xsd', 'pattern': '**/*.hidden-tmTheme'}], 'validation': {'resolveExternalEntities': False, 'schema': {'enabled': 'always'}, 'disallowDocTypeDecl': False, 'enabled': True, 'noGrammar': 'hint'}, 'catalogs': [], 'preferences': {'quoteStyle': 'double', 'showSchemaDocumentationType': 'all'}, 'format': {'spaceBeforeEmptyCloseTag': True, 'joinCommentLines': False, 'preserveEmptyContent': False, 'splitAttributes': False, 'joinContentLines': False, 'joinCDATALines': False, 'enabled': True, 'preserveAttributeLineBreaks': False, 'preservedNewlines': 2, 'enforceQuoteStyle': 'ignore', 'emptyElements': 'ignore'}, 'logs': {'client': True}, 'trace': {'server': 'off'}, 'server': {'workDir': '/home/lpanebr/.cache/sublime-text/Package Storage/LSP-lemminx'}, 'completion': {'autoCloseTags': False}, 'codeLens': {'enabled': False}, 'symbols': {'excluded': [], 'enabled': True, 'maxItemsComputed': 5000}}}}
:: -> LemMinX textDocument/didOpen: <params with 33956 characters>
:: <-- LemMinX client/registerCapability(1): {'registrations': [{'method': 'textDocument/codeAction', 'id': 'fafe4068-2fd5-4be9-91d2-0130b4c8fc17'}]}
:: >>> LemMinX 1: None
:: <-- LemMinX client/registerCapability(2): {'registrations': [{'registerOptions': {'resolveProvider': False, 'triggerCharacters': ['.', ':', '<', '"', '=', '/', '\\', '?', "'", '&']}, 'method': 'textDocument/completion', 'id': '50280953-b7cf-4e0f-a6e7-4eda17a97924'}]}
:: >>> LemMinX 2: None
:: <-- LemMinX client/registerCapability(3): {'registrations': [{'method': 'textDocument/documentHighlight', 'id': 'df412b2c-29af-401a-bc0a-8dc553b3ae0f'}]}
:: >>> LemMinX 3: None
:: <-- LemMinX client/registerCapability(4): {'registrations': [{'method': 'textDocument/hover', 'id': '17a8491b-a7c8-44c0-8086-8456d5d9c2ee'}]}
:: >>> LemMinX 4: None
:: <-- LemMinX client/registerCapability(5): {'registrations': [{'method': 'textDocument/rename', 'id': 'baeac71d-5d2c-4af5-b3a7-20d5a67ec9d6'}]}
:: >>> LemMinX 5: None
:: <-- LemMinX client/registerCapability(6): {'registrations': [{'method': 'textDocument/definition', 'id': '2756cc0d-4b8f-45bf-9c12-39b553c0ca53'}]}
:: >>> LemMinX 6: None
:: <-- LemMinX client/registerCapability(7): {'registrations': [{'method': 'textDocument/typeDefinition', 'id': '86414579-5462-4dd4-8079-acdd56c9b2fe'}]}
:: >>> LemMinX 7: None
:: <-- LemMinX client/registerCapability(8): {'registrations': [{'method': 'textDocument/references', 'id': '5f681a2f-3a94-4918-ac69-d0c23955d025'}]}
:: >>> LemMinX 8: None
:: <-- LemMinX client/registerCapability(9): {'registrations': [{'method': 'textDocument/formatting', 'id': '2cab817b-1935-4529-84a0-7229d33b0d88'}]}
:: >>> LemMinX 9: None
:: <-- LemMinX client/registerCapability(10): {'registrations': [{'method': 'textDocument/rangeFormatting', 'id': '6d138127-24a4-44aa-bbfc-9c46719c97d2'}]}
:: >>> LemMinX 10: None
:: <-- LemMinX client/registerCapability(11): {'registrations': [{'method': 'textDocument/selectionRange', 'id': 'a14999ad-8059-48e8-b8bc-cdb3f3ed0539'}]}
:: >>> LemMinX 11: None
:: <-- LemMinX client/registerCapability(12): {'registrations': [{'method': 'textDocument/documentSymbol', 'id': '67987587-abfb-4c3b-b055-90c494d192f3'}]}
:: >>> LemMinX 12: None
LemMinX: Dec 08, 2021 07:45:49 org.eclipse.lemminx.logs.LogHelper initializeRootLogger()
Message: Log file could not be created, path not provided
:: <- LemMinX window/logMessage: {'type': 3, 'message': 'Dec 08, 2021 07:45:49 org.eclipse.lemminx.logs.LogHelper initializeRootLogger()\nMessage: Log file could not be created, path not provided'}
:: <-- LemMinX client/registerCapability(13): {'registrations': [{'registerOptions': {'commands': ['xml.check.bound.grammar', 'xml.associate.grammar.insert', 'xml.validation.current.file', 'xml.check.file.pattern', 'xml.validation.all.files']}, 'method': 'workspace/executeCommand', 'id': '426eaed2-8736-4dea-8377-bf45060b499d'}]}
:: >>> LemMinX 13: None
:: <- LemMinX textDocument/publishDiagnostics: <params with 108071 characters>
:: <? LemMinX telemetry/event: {'properties': {'file.resolver': 'default', 'file.extension': 'xml', 'file.grammar.doctype': True}, 'name': 'server.document.open'}
:: --> LemMinX textDocument/hover(2): {'textDocument': {'uri': 'file:///home/lpanebr/Desktop/xmlproject/bjbNC250727_EN_out.xml'}, 'position': {'line': 1, 'character': 102}}
:: --> LemMinX textDocument/codeAction(3): <params with 11250 characters>
:: <<< LemMinX 2: None
:: <-- LemMinX workspace/configuration(14): {'items': [{'scopeUri': 'file:///home/lpanebr/Desktop/xmlproject/bjbNC250727_EN_out.xml', 'section': 'xml.format.insertSpaces'}, {'scopeUri': 'file:///home/lpanebr/Desktop/xmlproject/bjbNC250727_EN_out.xml', 'section': 'xml.format.tabSize'}]}
:: >>> LemMinX 14: [None, None]
:: <<< LemMinX 3: []
:: --> LemMinX textDocument/hover(4): {'textDocument': {'uri': 'file:///home/lpanebr/Desktop/xmlproject/bjbNC250727_EN_out.xml'}, 'position': {'line': 1, 'character': 96}}
:: <<< LemMinX 4: None
:: --> LemMinX textDocument/hover(5): {'textDocument': {'uri': 'file:///home/lpanebr/Desktop/xmlproject/bjbNC250727_EN_out.xml'}, 'position': {'line': 1, 'character': 95}}
:: <<< LemMinX 5: None
I have misunderstood you. I thought that it just doesn't work at all or is crashing.
Since your issue is just with getting unwanted diagnostics, that's more up to configuration and the project itself. Maybe @deathaxe will be able to help you witih that.
$ java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
You could update the summary to state the issue clearer. The message from LSP-troubleshooting is not really relevant here (I'm making that command work better in https://github.com/sublimelsp/LSP/pull/1916 though).
Thanks! I'll edit the issue description. It is weird that it started working... maybe one of the reinstalls kind of fixed it.
It looks like a language server issue to me. It doesn't resolve local catalog.xml
declarations correctly. I used 3.0 for debugging as it ships with a ready catalog.xml.
{
"settings":
{
"xml.catalogs": [
"file://C:/Data/catalogs/JATS-3/catalog-v3.xml"
]
}
}
LemMinX seems to correctly register the catalog according to its logs.
LemMinX: Dez. 08, 2021 07:27:41 org.eclipse.lemminx.extensions.contentmodel.uriresolver.XMLCatalogResolverExtension setCatalogs()
Message: Adding XML catalog 'file://C:/Data/catalogs/JATS-3/catalog-v3.xml' with expand system id 'file://C:/Data/catalogs/JATS-3/catalog-v3.xml' and root URI 'file:///C:/Data/catalogs/JATS-3/'.
Don't see issues, and auto completion suggests something. Seems to work.
When changing to a publich ID I see exactly the same issues about nondeclared entities
<!-- <!DOCTYPE article SYSTEM "../journalpublishing3.dtd"> -->
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "journalpublishing3.dtd">
The issue is LemMinX expects the uri
to target to a valid file.
Same happens to you as the remote uri doesn't exist.
If I change the uri to
<!-- <!DOCTYPE article SYSTEM "../journalpublishing3.dtd"> -->
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "../journalpublishing3.dtd">
... everything starts working fine as the relative uri now points to the correct local folder.
I'd expect LemMinX to resolve the PUBLIC Id "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN"
using information from file://C:/Data/catalogs/JATS-3/catalog-v3.xml
, but this doesn't seem to work.
This kind of issue needs to be fixed by the language server devs.
Maybe worth an issue at https://github.com/eclipse/lemminx
thanks @deathaxe I can confirm that using a relative path in the System Id the LSP stuff works.
I still get lots of errors though and was unable to get the catalogs working.. I've created an issue as you suggested and it's getting attention ❤️ . In case anyone wants it's https://github.com/eclipse/lemminx/issues/1141
I think the problem of this issue is that it doesn't resolve external entities.
I don't know how LSP Sumblime can configure the lemMinX LS, but you can see the settings in vscode-xml in https://github.com/redhat-developer/vscode-xml/wiki/XMLValidation#resolve-external-entities
Tried that, without luck.
Tried that, without luck.
My answer was for https://github.com/sublimelsp/LSP-lemminx/issues/13#issuecomment-988709764
For the other issue XML catalog should resolve the problem, but it seems that XML catalog doesn't work for you? I tried quickly with vscode-xml https://github.com/eclipse/lemminx/issues/1141#issuecomment-1002633546 and it seems it's working:
Thank you again guys!
Just for the record: it was all my fault not knowing how to configure my IDEs... 🤦
For VSCode: in the redhat vscode-xml plugin settings
For Sublime Text: LSP-lemminx.sublime-settings
file.
{
"settings":
{
"xml.catalogs": [
"/home/lpanebr/catalogs/catalog.xml"
],
"xml.validation.resolveExternalEntities": true,
}
}
Anyone using this: mind the path/filename
needs to be adjusted according to your OS. (I did miss that also...)
Still looking into Neovim.
I did it. Finally.
My problem with Neovim was the same as with Sublime and VS Code:
In case anyone ever needs to set up Lemminx via nvim-lspconfig in Neovim, here's how to pass settings to the config:
xml = {
catalogs = { "/home/lpanebr/catalogs/catalog.xml" },
validation = {
resolveExternalEntities = true
}
}
I'll send a PR so that this gets added to the nvim-lspconfig server_configurations example for lemminx.
Thank you so much again! This non-issue is resolved.
Hi @lpanebr, I'm facing s similar issue, trying to provide a custom xsd file to lemminx to parse. The header of xml file (They have arxml extension though)
<?xml version="1.0" encoding="UTF-8"?>
<AUTOSAR xmlns="http://autosar.org/schema/r4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://autosar.org/schema/r4.0 AUTOSAR_00049.xsd">
If I copy the AUTOSAR_00049.xsd
beside the arxml file, lemminx parses it and gives the documention and hovering stuff. To avoid copying the xsd file every where, I'm trying to configure the lemminx to pick it up from a common place. As documented here : https://github.com/eclipse/lemminx/blob/main/docs/Configuration.md#file-associations
So I configured lspconfig in neovim like :
require('lspconfig').lemminx.setup {
handlers = conf.handlers,
on_attach = conf.on_attach,
capabilities = conf.capabilities,
autostart = true,
settings = {
xml = {
fileAssociations = {
systemId = "~/.cache/lemminx/AUTOSAR_MMOD_XMLSchema/AUTOSAR_00049.xsd",
pattern = "arxml"
},
server = {
workDir = "~/.cache/lemminx",
}
}
}
}
I also tried :
fileAssociations = { {
["systemId"] = "~/.cache/lemminx/AUTOSAR_MMOD_XMLSchema/AUTOSAR_00049.xsd",
["pattern"] = "arxml"
} },
But it doesn't work, any idea ?
The most appropriate approach would be to create a local scheme catalog.
Place your scheme to a folder of choice (e.g. _~/my-xml-catalogs/autosar/AUTOSAR00049.xsd):
<?xml version="1.0" encoding="UTF-8"?>
<!-- EXAMPLE stub -->
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="http://autosar.org/schema/r4.0">
...
</xs:schema>
In same folder create a ~/my-xml-catalogs/autosar/catalog.xml:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN"
"http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri name="http://autosar.org/schema/r4.0" uri="AUTOSAR_00049.xsd"/>
</catalog>
In settings configure the catalog to use:
Neovim
settings = {
xml = {
catalogs = [
"~/my-xml-catalogs/autosar/catalog.xml"
]
}
}
ST (LSP-lemminx.sublime-settings):
{
"settings":
{
"xml.catalogs": [
"~/my-xml-catalogs/autosar/catalog.xml"
]
}
}
@sadtab the lemminx doc is out of dated, I suggest that you read doc from vscode-xml at https://github.com/redhat-developer/vscode-xml/blob/main/docs/
See file association docassociation
I suggest that you try:
pattern = "**/*.arxml"
@angelozerr I tried
require('lspconfig').lemminx.setup {
handlers = conf.handlers,
on_attach = conf.on_attach,
capabilities = conf.capabilities,
autostart = true,
settings = {
xml = {
fileAssociations = { {
["systemId"] = "~/.cache/lemminx/AUTOSAR_MMOD_XMLSchema/AUTOSAR_00049.xsd",
["pattern"] = "**/*arxml"
} },
server = {
workDir = "~/.cache/lemminx",
}
}
}
}
and
require('lspconfig').lemminx.setup {
handlers = conf.handlers,
on_attach = conf.on_attach,
capabilities = conf.capabilities,
autostart = true,
settings = {
xml = {
fileAssociations = {
systemId = "~/.cache/lemminx/AUTOSAR_MMOD_XMLSchema/AUTOSAR_00049.xsd",
pattern = "**/*arxml"
},
server = {
workDir = "~/.cache/lemminx",
}
}
}
}
Didn't help
@deathaxe, I tried what you proposed, I created a catalog.xml file like :
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN"
"http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri name="http://autosar.org/schema/r4.0" uri="AUTOSAR_00049.xsd"/>
</catalog>
IDK if I was supposed to change anything in there. Then I updated the conf file like :
xml = {
catalogs = {
"~/.cache/lemminx/AUTOSAR_MMOD_XMLSchema/catalog.xm",
},
server = {
workDir = "~/.cache/lemminx",
}
Still not working, How you used brackets [] in you comment is not a valid lua syntax, that's why i replaced them with {}
Maybe due to l
missing in .xml
? Otherwise you are on your own. It's working fine in ST, which this repository primarily targets.
@deathaxe Good catch but still not working, do you have a functioning lua config for this on github ?
Finally made it, I just blindly searched the require('lspconfig').lemminx.setup catalog
in the whole github and found this https://github.com/iinm/dotfiles/blob/26fbab3d8d3f9b77aa31848183bab74b6b366caa/.config/nvim/init.lua#L548, Apparently lemminx don't expand ~
thanks @iinm for sharing your dot files
I've:
and I get lots of errors everywhere.
initially I was getting the
neither "command" nor "tcp_port" is provided; cannot start a language server
error but it got fixed somehow (I guess one of the reinstalls).Now I get the errors described in the comments below.
Any idea on how could I fix this please?