Skip to content

Incorrect snippet completions #68

@rwols

Description

@rwols

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions