neoclide / coc-solargraph

Solargraph extension for coc.nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Autoformat issue on EnforcedStyleForMultiline

Seybo opened this issue · comments

I have an empty ruby project with just two files:

  1. .rubocop.yml
Style/TrailingCommaInHashLiteral:
  EnforcedStyleForMultiline: comma
  1. test.rb
class Test
  def test
    {
      foo: 'one',
      bar: 'two'
    }
  end
end

Here is the warning I get on the bar: line: [Style/TrailingCommaInHashLiteral] [I] Put a comma after the last item of a multiline hash. Which is the expected warning

But when I call CocAction('format') nothing changes. If I add a comma myself, the warning disappears but when I run format, it removes it.

If I just run rubocop -a test.rb from the console, it formats the line correctly (adds the comma).

The rest of the cops I'm trying are working just fine but this one doesn't work for some reason.

coc-solargraph 1.1.8

[I] ✦ ➜ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]

[I] ✦ ➜ rubocop -v
0.89.1

[I] ✦ ➜ solargraph -v
0.40.1

do you see anything suspicious here? almost in the end, at [Trace - 10:50:39 AM] i call format and it removes the comma

[Trace - 10:48:52 AM] Sending request 'initialize - (0)'.
Params: {
    "processId": 18949,
    "rootPath": "/mnt/dev/learning/rubocop_test",
    "rootUri": "file:///mnt/dev/learning/rubocop_test",
    "capabilities": {
        "workspace": {
            "applyEdit": true,
            "workspaceEdit": {
                "documentChanges": true,
                "resourceOperations": [
                    "create",
                    "rename",
                    "delete"
                ],
                "failureHandling": "textOnlyTransactional"
            },
            "didChangeConfiguration": {
                "dynamicRegistration": true
            },
            "didChangeWatchedFiles": {
                "dynamicRegistration": 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
                    ]
                }
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "configuration": true,
            "workspaceFolders": true
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true,
                "versionSupport": false,
                "tagSupport": {
                    "valueSet": [
                        1,
                        2
                    ]
                }
            },
            "synchronization": {
                "dynamicRegistration": true,
                "willSave": true,
                "willSaveWaitUntil": true,
                "didSave": true
            },
            "completion": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "completionItem": {
                    "snippetSupport": true,
                    "commitCharactersSupport": true,
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "deprecatedSupport": true,
                    "preselectSupport": true,
                    "tagSupport": {
                        "valueSet": [
                            1
                        ]
                    }
                },
                "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
                    ]
                }
            },
            "hover": {
                "dynamicRegistration": true,
                "contentFormat": [
                    "markdown",
                    "plaintext"
                ]
            },
            "signatureHelp": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "signatureInformation": {
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "activeParameterSupport": true,
                    "parameterInformation": {
                        "labelOffsetSupport": true
                    }
                }
            },
            "definition": {
                "dynamicRegistration": true
            },
            "references": {
                "dynamicRegistration": true
            },
            "documentHighlight": {
                "dynamicRegistration": 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
                    ]
                },
                "hierarchicalDocumentSymbolSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                }
            },
            "codeAction": {
                "dynamicRegistration": true,
                "isPreferredSupport": true,
                "codeActionLiteralSupport": {
                    "codeActionKind": {
                        "valueSet": [
                            "",
                            "quickfix",
                            "refactor",
                            "refactor.extract",
                            "refactor.inline",
                            "refactor.rewrite",
                            "source",
                            "source.organizeImports"
                        ]
                    }
                }
            },
            "codeLens": {
                "dynamicRegistration": true
            },
            "formatting": {
                "dynamicRegistration": true
            },
            "rangeFormatting": {
                "dynamicRegistration": true
            },
            "onTypeFormatting": {
                "dynamicRegistration": true
            },
            "rename": {
                "dynamicRegistration": true,
                "prepareSupport": true
            },
            "documentLink": {
                "dynamicRegistration": true,
                "tooltipSupport": true
            },
            "typeDefinition": {
                "dynamicRegistration": true
            },
            "implementation": {
                "dynamicRegistration": true
            },
            "declaration": {
                "dynamicRegistration": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true
            },
            "selectionRange": {
                "dynamicRegistration": true
            }
        },
        "window": {
            "workDoneProgress": true
        }
    },
    "initializationOptions": {
        "enablePages": true,
        "viewsPath": "/home/glaux/.config/coc/extensions/node_modules/coc-solargraph/views"
    },
    "trace": "verbose",
    "workspaceFolders": [
        {
            "uri": "file:///mnt/dev/learning/rubocop_test",
            "name": "rubocop_test"
        }
    ],
    "clientInfo": {
        "name": "coc.nvim",
        "version": "0.0.80"
    }
}


[Trace - 10:48:54 AM] Received response 'initialize - (0)' in 2498ms.
Result: {
    "capabilities": {
        "textDocumentSync": 2,
        "workspace": {
            "workspaceFolders": {
                "supported": true,
                "changeNotifications": true
            }
        }
    }
}


[Trace - 10:48:54 AM] Sending notification 'initialized'.
Params: {}


[Trace - 10:48:54 AM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
    "settings": {
        "solargraph": {
            "trace": {
                "server": "verbose"
            },
            "transport": "socket",
            "promptDownload": true,
            "externalServer": {
                "host": "localhost",
                "port": 7658
            },
            "commandPath": "solargraph",
            "useBundler": false,
            "bundlerPath": "bundle",
            "checkGemVersion": true,
            "completion": true,
            "hover": true,
            "diagnostics": true,
            "autoformat": false,
            "formatting": true,
            "symbols": true,
            "definitions": true,
            "rename": true,
            "references": true,
            "folding": true,
            "logLevel": "debug"
        }
    }
}


[Trace - 10:48:54 AM] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///mnt/dev/learning/rubocop_test/test.rb",
        "languageId": "ruby",
        "version": 1,
        "text": "# frozen_string_literal: true\n\n# Test\nclass Test\n  def test\n    {\n      foo: 'one',\n      bar: 'two'\n    }\n  end\nend\n"
    }
}


[Trace - 10:48:54 AM] Sending notification '$/solargraph/checkGemVersion'.
Params: {
    "verbose": false
}


[Trace - 10:48:54 AM] Received request 'client/registerCapability - (0)'.
Params: {
    "registrations": [
        {
            "id": "textDocument/completion",
            "method": "textDocument/completion",
            "registerOptions": {
                "resolveProvider": true,
                "triggerCharacters": [
                    ".",
                    ":",
                    "@"
                ]
            }
        },
        {
            "id": "textDocument/hover",
            "method": "textDocument/hover",
            "registerOptions": null
        },
        {
            "id": "textDocument/signatureHelp",
            "method": "textDocument/signatureHelp",
            "registerOptions": {
                "triggerCharacters": [
                    "(",
                    ",",
                    " "
                ]
            }
        },
        {
            "id": "textDocument/formatting",
            "method": "textDocument/formatting",
            "registerOptions": {
                "formattingProvider": true
            }
        },
        {
            "id": "textDocument/documentSymbol",
            "method": "textDocument/documentSymbol",
            "registerOptions": {
                "documentSymbolProvider": true
            }
        },
        {
            "id": "textDocument/definition",
            "method": "textDocument/definition",
            "registerOptions": {
                "definitionProvider": true
            }
        },
        {
            "id": "textDocument/references",
            "method": "textDocument/references",
            "registerOptions": {
                "referencesProvider": true
            }
        },
        {
            "id": "textDocument/rename",
            "method": "textDocument/rename",
            "registerOptions": {
                "renameProvider": true
            }
        },
        {
            "id": "textDocument/foldingRange",
            "method": "textDocument/foldingRange",
            "registerOptions": {
                "foldingRangeProvider": true
            }
        },
        {
            "id": "workspace/symbol",
            "method": "workspace/symbol",
            "registerOptions": {
                "workspaceSymbolProvider": true
            }
        }
    ]
}


[Trace - 10:48:54 AM] Sending response 'client/registerCapability - (0)'. Processing request took 4ms
No result returned.


[Trace - 10:48:54 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///mnt/dev/learning/rubocop_test/test.rb",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 7,
                    "character": 6
                },
                "end": {
                    "line": 7,
                    "character": 16
                }
            },
            "severity": 3,
            "source": "Style/TrailingCommaInHashLiteral",
            "message": " Put a comma after the last item of a multiline hash."
        }
    ]
}


[Trace - 10:50:11 AM] Sending notification 'textDocument/didChange'.
Params: {
    "textDocument": {
        "version": 2,
        "uri": "file:///mnt/dev/learning/rubocop_test/test.rb"
    },
    "contentChanges": [
        {
            "range": {
                "start": {
                    "line": 7,
                    "character": 16
                },
                "end": {
                    "line": 7,
                    "character": 16
                }
            },
            "rangeLength": 0,
            "text": ","
        }
    ]
}


[Trace - 10:50:11 AM] Sending request 'textDocument/signatureHelp - (1)'.
Params: {
    "textDocument": {
        "uri": "file:///mnt/dev/learning/rubocop_test/test.rb"
    },
    "position": {
        "line": 7,
        "character": 17
    },
    "context": {
        "isRetrigger": false,
        "triggerKind": 2
    }
}


[Trace - 10:50:11 AM] Received response 'textDocument/signatureHelp - (1)' in 8ms.
Result: {
    "signatures": []
}


[Trace - 10:50:11 AM] Sending notification '$/cancelRequest'.
Params: {
    "id": 1
}


[Trace - 10:50:11 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///mnt/dev/learning/rubocop_test/test.rb",
    "diagnostics": []
}


[Trace - 10:50:13 AM] Sending notification 'textDocument/didSave'.
Params: {
    "textDocument": {
        "uri": "file:///mnt/dev/learning/rubocop_test/test.rb",
        "version": 2
    }
}


[Trace - 10:50:39 AM] Sending request 'textDocument/formatting - (2)'.
Params: {
    "textDocument": {
        "uri": "file:///mnt/dev/learning/rubocop_test/test.rb"
    },
    "options": {
        "tabSize": 2,
        "insertSpaces": true
    }
}


[Trace - 10:50:39 AM] Received response 'textDocument/formatting - (2)' in 102ms.
Result: [
    {
        "range": {
            "start": {
                "line": 0,
                "character": 0
            },
            "end": {
                "line": 11,
                "character": 0
            }
        },
        "newText": "# frozen_string_literal: true\n\n# Test\nclss Test\n  def test\n    {\n      foo: 'one',\n      bar: 'two'\n    }\n  end\nend\n"
    }
]


[Trace - 10:50:39 AM] Sending notification 'textDocument/didChange'.
Params: {
    "textDocument": {
        "version": 3,
        "uri": "file:///mnt/dev/learning/rubocop_test/test.rb"
    },
    "contentChanges": [
        {
            "range": {
                "start": {
                    "line": 7,
                    "character": 16
                },
                "end": {
                    "line": 7,
                    "character": 17
                }
            },
            "rangeLength": 1,
            "text": ""
        }
    ]
}


[Trace - 10:50:40 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///mnt/dev/learning/rubocop_test/test.rb",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 7,
                    "character": 6
                },
                "end": {
                    "line": 7,
                    "character": 16
                }
            },
            "severity": 3,
            "source": "Style/TrailingCommaInHashLiteral",
            "message": " Put a comma after the last item of a multiline hash."
        }
    ]
}

Why closed? I've added the default configuration and nothing has changed