Closed predragnikolic closed 3 years ago
Getting this:
LSP: LSP-tailwindcss: registering capability: completionProvider
['"', "'", '`', ' ', '.', '[', '!', None]
Traceback (most recent call last):
File "/Users/../Packages/LSP/plugin/session_view.py", line 157, in on_capability_added_async
self._register_auto_complete_triggers(registration_id, trigger_chars or [])
File "/Users/../Packages/LSP/plugin/session_view.py", line 88, in _register_auto_complete_triggers
self._apply_auto_complete_triggers(self.view.settings(), trigger_chars, registration_id)
File "/Users/../Packages/LSP/plugin/session_view.py", line 123, in _apply_auto_complete_triggers
trigger["characters"] = "".join(trigger_chars)
TypeError: sequence item 7: expected str instance, NoneType found
One of the completion triggers is None
.
If I comment out this https://github.com/sublimelsp/LSP-tailwindcss/pull/4/files#diff-08655555cc53ca79554ba180d1ae7e6ebe5c9b0a25e1772ce248fdd8b83dab34R19-R25
and clone this repo install the npm deps
And open a src/index.js
file
I get these logs:
:: --> LSP-tailwindcss initialize(1): {'initializationOptions': {}, 'processId': 10988, 'clientInfo': {'version': '1.3.1', 'name': 'Sublime Text LSP'}, 'rootUri': 'file:///C:/Users/Predrag/Documents/sandbox/tailwind-example', 'workspaceFolders': [{'uri': 'file:///C:/Users/Predrag/Documents/sandbox/tailwind-example', 'name': 'tailwind-example'}], 'rootPath': 'C:\\Users\\Predrag\\Documents\\sandbox\\tailwind-example', 'capabilities': {'textDocument': {'signatureHelp': {'dynamicRegistration': True, 'signatureInformation': {'documentationFormat': ['markdown', 'plaintext'], 'parameterInformation': {'labelOffsetSupport': True}}}, 'selectionRange': {'dynamicRegistration': True}, 'documentHighlight': {'dynamicRegistration': True}, 'typeDefinition': {'dynamicRegistration': True, 'linkSupport': True}, 'colorProvider': {'dynamicRegistration': True}, 'codeLens': {'dynamicRegistration': True}, 'rangeFormatting': {'dynamicRegistration': True}, 'declaration': {'dynamicRegistration': True, 'linkSupport': True}, 'publishDiagnostics': {'codeDescriptionSupport': True, 'relatedInformation': True, 'dataSupport': True, 'tagSupport': {'valueSet': [2, 1]}, 'versionSupport': True}, 'implementation': {'dynamicRegistration': True, 'linkSupport': True}, 'synchronization': {'dynamicRegistration': True, 'willSaveWaitUntil': True, 'didSave': True, 'willSave': True}, 'references': {'dynamicRegistration': True}, 'hover': {'dynamicRegistration': True, 'contentFormat': ['markdown', 'plaintext']}, 'definition': {'dynamicRegistration': True, 'linkSupport': True}, 'codeAction': {'dynamicRegistration': True, 'dataSupport': True, 'codeActionLiteralSupport': {'codeActionKind': {'valueSet': ['quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source.organizeImports']}}, 'resolveSupport': {'properties': ['edit']}}, 'formatting': {'dynamicRegistration': True}, 'rename': {'dynamicRegistration': True, 'prepareSupport': True}, 'completion': {'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]}, 'completionItem': {'snippetSupport': True, 'resolveSupport': {'properties': ['detail', 'documentation', 'additionalTextEdits']}, 'documentationFormat': ['markdown', 'plaintext'], 'tagSupport': {'valueSet': [1]}, 'deprecatedSupport': True}}, 'documentSymbol': {'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]}, 'tagSupport': {'valueSet': [1]}, 'hierarchicalDocumentSymbolSupport': True}}, 'window': {'workDoneProgress': True, 'showMessage': {'messageActionItem': {'additionalPropertiesSupport': True}}, 'showDocument': {'support': True}}, 'experimental': {}, 'workspace': {'executeCommand': {}, 'configuration': True, 'symbol': {'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]}, 'tagSupport': {'valueSet': [1]}}, 'applyEdit': True, 'workspaceFolders': True, 'didChangeConfiguration': {'dynamicRegistration': True}, 'workspaceEdit': {'failureHandling': 'abort', 'documentChanges': True}}, 'general': {'regularExpressions': {'engine': 'ECMAScript'}, 'markdown': {'version': '3.2.2', 'parser': 'Python-Markdown'}}}}
:: <<< LSP-tailwindcss 1: {'capabilities': {'textDocumentSync': {'change': {'syncKind': 1}, 'didOpen': {}, 'didClose': {}, 'save': {}}}}
:: -> LSP-tailwindcss initialized: {}
:: -> LSP-tailwindcss workspace/didChangeConfiguration: {'settings': {'tailwindCSS': {'experimental': {'classRegex': []}, 'rootFontSize': 16, 'emmetCompletions': False, 'colorDecorators': True, 'validate': True, 'lint': {'invalidVariant': 'error', 'invalidScreen': 'error', 'cssConflict': 'warning', 'invalidConfigPath': 'error', 'invalidApply': 'error', 'invalidTailwindDirective': 'error', 'recommendedVariantOrder': 'warning'}, 'showPixelEquivalents': True}}}
:: -> LSP-tailwindcss textDocument/didOpen: {'textDocument': {'languageId': 'typescript', 'uri': 'file:///C:/Users/Predrag/Documents/sandbox/tailwind-example/src/index.ts', 'text': "import './styles.css';\n", 'version': 0}}
LSP-tailwindcss: Found Tailwind CSS config file: c:\Users\Predrag\Documents\sandbox\tailwind-example\tailwind.config.js
LSP-tailwindcss: Loaded postcss v7.0.18: c:\Users\Predrag\Documents\sandbox\tailwind-example\node_modules\postcss
LSP-tailwindcss: Loaded tailwindcss v1.1.2: c:\Users\Predrag\Documents\sandbox\tailwind-example\node_modules\tailwindcss
:: <- LSP-tailwindcss window/logMessage: {'message': 'Found Tailwind CSS config file: c:\\Users\\Predrag\\Documents\\sandbox\\tailwind-example\\tailwind.config.js', 'type': 4}
:: <- LSP-tailwindcss window/logMessage: {'message': 'Loaded postcss v7.0.18: c:\\Users\\Predrag\\Documents\\sandbox\\tailwind-example\\node_modules\\postcss', 'type': 4}
:: <- LSP-tailwindcss window/logMessage: {'message': 'Loaded tailwindcss v1.1.2: c:\\Users\\Predrag\\Documents\\sandbox\\tailwind-example\\node_modules\\tailwindcss', 'type': 4}
:: <-- LSP-tailwindcss workspace/configuration(0): {'items': [{'scopeUri': 'file:///C:/Users/Predrag/Documents/sandbox/tailwind-example/src/index.ts', 'section': 'editor'}]}
:: >>> LSP-tailwindcss 0: [None]
:: <-- LSP-tailwindcss workspace/configuration(1): {'items': [{'scopeUri': 'file:///C:/Users/Predrag/Documents/sandbox/tailwind-example/src/index.ts', 'section': 'tailwindCSS'}]}
:: >>> LSP-tailwindcss 1: [{'experimental': {'classRegex': []}, 'rootFontSize': 16, 'emmetCompletions': False, 'colorDecorators': True, 'validate': True, 'lint': {'invalidVariant': 'error', 'invalidScreen': 'error', 'cssConflict': 'warning', 'invalidConfigPath': 'error', 'invalidApply': 'error', 'invalidTailwindDirective': 'error', 'recommendedVariantOrder': 'warning'}, 'showPixelEquivalents': True}]
:: <-- LSP-tailwindcss client/registerCapability(2): {'registrations': [{'id': '8cf6796d-919c-4262-a662-101961574647', 'registerOptions': {'documentSelector': None}, 'method': 'textDocument/hover'}, {'id': '456b608d-357c-472d-ae0c-a9546478ad88', 'registerOptions': {'documentSelector': None}, 'method': 'textDocument/documentColor'}, {'id': '06cd2567-0c9a-48f9-9d88-a030a594d194', 'registerOptions': {'documentSelector': None}, 'method': 'textDocument/codeAction'}, {'id': '4b5a3860-2b60-45b7-8754-875e5e49a962', 'registerOptions': {'triggerCharacters': ['"', "'", '`', ' ', '.', '[', '!', ':'], 'resolveProvider': True, 'documentSelector': None}, 'method': 'textDocument/completion'}]}
:: >>> LSP-tailwindcss 2: None
LSP-tailwindcss: Unhandled exception: Cannot convert undefined or null to object
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at pe (C:\Users\Predrag\AppData\Local\Sublime Text\Package Storage\LSP-tailwindcss\14.17.0\language-server\extension\dist\server\index.js:54:290352)
at C:\Users\Predrag\AppData\Local\Sublime Text\Package Storage\LSP-tailwindcss\14.17.0\language-server\extension\dist\server\index.js:54:298781
at Generator.next (<anonymous>)
at C:\Users\Predrag\AppData\Local\Sublime Text\Package Storage\LSP-tailwindcss\14.17.0\language-server\extension\dist\server\index.js:54:295587
at new Promise (<anonymous>)
at Oe (C:\Users\Predrag\AppData\Local\Sublime Text\Package Storage\LSP-tailwindcss\14.17.0\language-server\extension\dist\server\index.js:54:295332)
at $e (C:\Users\Predrag\AppData\Local\Sublime Text\Package Storage\LSP-tailwindcss\14.17.0\language-server\extension\dist\server\index.js:54:298743)
at C:\Users\Predrag\AppData\Local\Sublime Text\Package Storage\LSP-tailwindcss\14.17.0\language-server\extension\dist\server\index.js:54:324069
at Generator.next (<anonymous>)
:: <- LSP-tailwindcss window/logMessage: {'message': 'Unhandled exception: Cannot convert undefined or null to object\nTypeError: Cannot convert undefined or null to object\n at Function.keys (<anonymous>)\n at pe (C:\\Users\\Predrag\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-tailwindcss\\14.17.0\\language-server\\extension\\dist\\server\\index.js:54:290352)\n at C:\\Users\\Predrag\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-tailwindcss\\14.17.0\\language-server\\extension\\dist\\server\\index.js:54:298781\n at Generator.next (<anonymous>)\n at C:\\Users\\Predrag\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-tailwindcss\\14.17.0\\language-server\\extension\\dist\\server\\index.js:54:295587\n at new Promise (<anonymous>)\n at Oe (C:\\Users\\Predrag\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-tailwindcss\\14.17.0\\language-server\\extension\\dist\\server\\index.js:54:295332)\n at $e (C:\\Users\\Predrag\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-tailwindcss\\14.17.0\\language-server\\extension\\dist\\server\\index.js:54:298743)\n at C:\\Users\\Predrag\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-tailwindcss\\14.17.0\\language-server\\extension\\dist\\server\\index.js:54:324069\n at Generator.next (<anonymous>)', 'type': 1}
I am not getting None
in the triggerCharacters
completions.
For me it is failing on the client/registerCapability
call.
If I uncomment the code again. https://github.com/sublimelsp/LSP-tailwindcss/pull/4/files#diff-08655555cc53ca79554ba180d1ae7e6ebe5c9b0a25e1772ce248fdd8b83dab34R19-R25 I get these logs:
:: --> LSP-tailwindcss initialize(1): {'processId': 11456, 'workspaceFolders': [{'name': 'tailwind-example', 'uri': 'file:///C:/Users/Predrag/Documents/sandbox/tailwind-example'}], 'rootUri': 'file:///C:/Users/Predrag/Documents/sandbox/tailwind-example', 'capabilities': {'experimental': {}, 'window': {'showMessage': {'messageActionItem': {'additionalPropertiesSupport': True}}, 'showDocument': {'support': True}, 'workDoneProgress': True}, 'general': {'markdown': {'parser': 'Python-Markdown', 'version': '3.2.2'}, 'regularExpressions': {'engine': 'ECMAScript'}}, 'textDocument': {'publishDiagnostics': {'tagSupport': {'valueSet': [2, 1]}, 'versionSupport': True, 'dataSupport': True, 'relatedInformation': True, 'codeDescriptionSupport': True}, 'declaration': {'linkSupport': True, 'dynamicRegistration': True}, 'implementation': {'linkSupport': True, 'dynamicRegistration': True}, 'selectionRange': {'dynamicRegistration': True}, 'colorProvider': {'dynamicRegistration': True}, '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]}}, 'completion': {'completionItem': {'tagSupport': {'valueSet': [1]}, 'resolveSupport': {'properties': ['detail', 'documentation', 'additionalTextEdits']}, 'deprecatedSupport': True, 'snippetSupport': True, 'documentationFormat': ['markdown', 'plaintext']}, '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]}, 'dynamicRegistration': True}, 'typeDefinition': {'linkSupport': True, 'dynamicRegistration': True}, 'references': {'dynamicRegistration': True}, 'rangeFormatting': {'dynamicRegistration': True}, 'documentHighlight': {'dynamicRegistration': True}, 'formatting': {'dynamicRegistration': True}, 'codeLens': {'dynamicRegistration': True}, 'synchronization': {'willSave': True, 'willSaveWaitUntil': True, 'didSave': True, 'dynamicRegistration': True}, 'rename': {'dynamicRegistration': True, 'prepareSupport': True}, 'codeAction': {'codeActionLiteralSupport': {'codeActionKind': {'valueSet': ['quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source.organizeImports']}}, 'resolveSupport': {'properties': ['edit']}, 'dynamicRegistration': True, 'dataSupport': True}, 'hover': {'contentFormat': ['markdown', 'plaintext'], 'dynamicRegistration': True}, 'definition': {'linkSupport': True, 'dynamicRegistration': True}, 'signatureHelp': {'signatureInformation': {'documentationFormat': ['markdown', 'plaintext'], 'parameterInformation': {'labelOffsetSupport': True}}, 'dynamicRegistration': True}}, 'workspace': {'workspaceFolders': True, 'didChangeConfiguration': {'dynamicRegistration': True}, 'workspaceEdit': {'documentChanges': True, 'failureHandling': 'abort'}, '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]}}, 'configuration': True, 'applyEdit': True, 'executeCommand': {}}}, 'initializationOptions': {'userLanguages': {}}, 'clientInfo': {'name': 'Sublime Text LSP', 'version': '1.3.1'}, 'rootPath': 'C:\\Users\\Predrag\\Documents\\sandbox\\tailwind-example'}
:: <<< LSP-tailwindcss 1: {'capabilities': {'textDocumentSync': {'save': {}, 'didOpen': {}, 'didClose': {}, 'change': {'syncKind': 1}}}}
:: -> LSP-tailwindcss initialized: {}
:: -> LSP-tailwindcss workspace/didChangeConfiguration: {'settings': {'tailwindCSS': {'colorDecorators': True, 'emmetCompletions': False, 'lint': {'invalidVariant': 'error', 'recommendedVariantOrder': 'warning', 'invalidTailwindDirective': 'error', 'invalidConfigPath': 'error', 'invalidScreen': 'error', 'cssConflict': 'warning', 'invalidApply': 'error'}, 'validate': True, 'showPixelEquivalents': True, 'experimental': {'classRegex': []}, 'rootFontSize': 16}}}
:: -> LSP-tailwindcss textDocument/didOpen: {'textDocument': {'languageId': 'javascript', 'uri': 'file:///C:/Users/Predrag/Documents/sandbox/tailwind-example/src/index.js', 'text': "import './styles.css';\n", 'version': 0}}
LSP-tailwindcss: Found Tailwind CSS config file: c:\Users\Predrag\Documents\sandbox\tailwind-example\tailwind.config.js
LSP-tailwindcss: Loaded postcss v7.0.18: c:\Users\Predrag\Documents\sandbox\tailwind-example\node_modules\postcss
LSP-tailwindcss: Loaded tailwindcss v1.1.2: c:\Users\Predrag\Documents\sandbox\tailwind-example\node_modules\tailwindcss
:: <- LSP-tailwindcss window/logMessage: {'type': 4, 'message': 'Found Tailwind CSS config file: c:\\Users\\Predrag\\Documents\\sandbox\\tailwind-example\\tailwind.config.js'}
:: <- LSP-tailwindcss window/logMessage: {'type': 4, 'message': 'Loaded postcss v7.0.18: c:\\Users\\Predrag\\Documents\\sandbox\\tailwind-example\\node_modules\\postcss'}
:: <- LSP-tailwindcss window/logMessage: {'type': 4, 'message': 'Loaded tailwindcss v1.1.2: c:\\Users\\Predrag\\Documents\\sandbox\\tailwind-example\\node_modules\\tailwindcss'}
:: <-- LSP-tailwindcss workspace/configuration(0): {'items': [{'section': 'editor', 'scopeUri': 'file:///C:/Users/Predrag/Documents/sandbox/tailwind-example/src/index.js'}]}
:: >>> LSP-tailwindcss 0: [None]
:: <-- LSP-tailwindcss workspace/configuration(1): {'items': [{'section': 'tailwindCSS', 'scopeUri': 'file:///C:/Users/Predrag/Documents/sandbox/tailwind-example/src/index.js'}]}
:: >>> LSP-tailwindcss 1: [{'colorDecorators': True, 'emmetCompletions': False, 'lint': {'invalidVariant': 'error', 'recommendedVariantOrder': 'warning', 'invalidTailwindDirective': 'error', 'invalidConfigPath': 'error', 'invalidScreen': 'error', 'cssConflict': 'warning', 'invalidApply': 'error'}, 'validate': True, 'showPixelEquivalents': True, 'experimental': {'classRegex': []}, 'rootFontSize': 16}]
:: <-- LSP-tailwindcss client/registerCapability(2): {'registrations': [{'registerOptions': {'documentSelector': None}, 'method': 'textDocument/hover', 'id': 'd0606354-505e-4acb-bc86-5bbc68691637'}, {'registerOptions': {'documentSelector': None}, 'method': 'textDocument/documentColor', 'id': '9cf75ab7-a317-48b6-acb1-991721614353'}, {'registerOptions': {'documentSelector': None}, 'method': 'textDocument/codeAction', 'id': 'e8f410c5-743b-4a0a-ab02-6a540b9930aa'}, {'registerOptions': {'triggerCharacters': ['"', "'", '`', ' ', '.', '[', '!', ':'], 'resolveProvider': True, 'documentSelector': None}, 'method': 'textDocument/completion', 'id': 'cbb8ceb3-0b20-4372-84dc-116d7192fc36'}]}
:: >>> LSP-tailwindcss 2: None
:: <- LSP-tailwindcss textDocument/publishDiagnostics: {'uri': 'file:///C:/Users/Predrag/Documents/sandbox/tailwind-example/src/index.js', 'diagnostics': []}
:: --> LSP-tailwindcss textDocument/codeAction(2): {'range': {'start': {'line': 0, 'character': 0}, 'end': {'line': 0, 'character': 0}}, 'textDocument': {'uri': 'file:///C:/Users/Predrag/Documents/sandbox/tailwind-example/src/index.js'}, 'context': {'diagnostics': []}}
:: <<< LSP-tailwindcss 2: []
One of the completion triggers is
None
.
This definitively happened to me when testing. I haven't tested with a proper project that includes the correct dependencies and configuration file.
Just FYI.
It is possible for Tailwind to set null
here for the trigger chars.
I found a way to reproduce it by opening a index.js
file without a tailwind.config.js
at root.(that file is needed for the tailwind server... should probably add a link to server requirements in the readme)
You could also check it in can_start
, similar to LSP-flow
Thanks, I will check it out.
This is the abstraction you would use in a lsp_utils-based plugin: https://sublimelsp.github.io/lsp_utils/client_handlers.html#lsp_utils.GenericClientHandler.is_allowed_to_start
add autocomplete of tailwind settings