Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect snippet completions #68

Open
rwols opened this issue Nov 3, 2020 · 3 comments
Open

Incorrect snippet completions #68

rwols opened this issue Nov 3, 2020 · 3 comments

Comments

@rwols
Copy link
Member

rwols commented Nov 3, 2020

This language server sends snippet completions like "operator": $1.

:: --> LSP-json textDocument/completion(102): {'position': {'character': 17, 'line': 9}, 'textDocument': {'uri': 'file:///Users/raoulwols/Library/Application%20Support/Sublime%20Text%203/Packages/LSP-json/Default.sublime-keymap'}}
:: <<< LSP-json 102: {'isIncomplete': False, 'items': [{'insertText': '"key"', 'label': 'key', 'kind': 10, 'documentation': '', 'textEdit': {'newText': '"key"', 'range': {'end': {'character': 18, 'line': 9}, 'start': {'character': 16, 'line': 9}}}, 'insertTextFormat': 2, 'filterText': '"key"'}, {'insertText': '"operator": $1', 'command': {'command': 'editor.action.triggerSuggest', 'title': 'Suggest'}, 'label': 'operator', 'kind': 10, 'documentation': {'value': 'The operator used to match the given `key` and the `operand`.', 'kind': 'markdown'}, 'textEdit': {'newText': '"operator": $1', 'range': {'end': {'character': 18, 'line': 9}, 'start': {'character': 16, 'line': 9}}}, 'insertTextFormat': 2, 'filterText': '"operator"'}, {'insertText': '"operand": ${1:true}', 'label': 'operand', 'kind': 10, 'documentation': '', 'textEdit': {'newText': '"operand": ${1:true}', 'range': {'end': {'character': 18, 'line': 9}, 'start': {'character': 16, 'line': 9}}}, 'insertTextFormat': 2, 'filterText': '"operand"'}, {'insertText': '"match_all": ${1:false}', 'label': 'match_all', 'kind': 10, 'documentation': {'value': 'If `true`, then the condition must evaluate to true for all selections.', 'kind': 'markdown'}, 'textEdit': {'newText': '"match_all": ${1:false}', 'range': {'end': {'character': 18, 'line': 9}, 'start': {'character': 16, 'line': 9}}}, 'insertTextFormat': 2, 'filterText': '"match_all"'}]}

The problem with that is that ST will accumulate "snippet fields" over time

image

The language server should instead return snippets like "operator": $0.

@rchl
Copy link
Member

rchl commented Nov 6, 2020

We should report it at https://github.com/microsoft/vscode-json-languageservice

But what is the issue with that, behavior-wise? It seems to allow jumping "after" the inserted snippet. I'm not sure in which cases it can get it in the way.

@rwols
Copy link
Member Author

rwols commented Nov 20, 2020

Tracked here microsoft/vscode-json-languageservice#81

@rwols
Copy link
Member Author

rwols commented Nov 20, 2020

But what is the issue with that, behavior-wise? It seems to allow jumping "after" the inserted snippet. I'm not sure in which cases it can get it in the way.

IMO I don't like how I can now jump to seemingly random places with shifttab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants