atom / atom-languageclient

Language Server Protocol support for Atom (the basis of Atom-IDE)
https://ide.atom.io/
MIT License
389 stars 78 forks source link

added impl for new code action service. fixes #239 #243

Closed cdietrich closed 5 years ago

cdietrich commented 5 years ago

added impl for new code action service. fixes #239 Signed-off-by: Christian Dietrich christian.dietrich@itemis.de

cdietrich commented 5 years ago

sample model

Hello lowercase!

sample diagnostics

{
  "jsonrpc": "2.0",
  "id": 39,
  "method": "textDocument/codeAction",
  "params": {
    "textDocument": {
      "uri": "file:///Users/dietrich/git/xtext-languageserver-example/demo/c.mydsl"
    },
    "range": {
      "start": {
        "line": 0,
        "character": 11
      },
      "end": {
        "line": 0,
        "character": 11
      }
    },
    "context": {
      "diagnostics": [
        {
          "range": {
            "start": {
              "line": 0,
              "character": 6
            },
            "end": {
              "line": 0,
              "character": 15
            }
          },
          "severity": 1,
          "code": "invalidName",
          "message": "Name should start with a capital"
        }
      ]
    }
  }
}

sample code action

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "textDocument/codeAction",
  "params": {
    "textDocument": {
      "uri": "file:///Users/dietrich/git/xtext-languageserver-example/demo/c.mydsl"
    },
    "range": {
      "start": {
        "line": 0,
        "character": 0
      },
      "end": {
        "line": 0,
        "character": 17
      }
    },
    "context": {
      "diagnostics": [
        {
          "range": {
            "start": {
              "line": 0,
              "character": 6
            },
            "end": {
              "line": 0,
              "character": 15
            }
          },
          "severity": 1,
          "code": "invalidName",
          "message": "Name should start with a capital"
        }
      ]
    }
  }
}

expected resulting model

Hello Lowercase!
damieng commented 5 years ago

Thanks! I'll get this tested as part of the next atom-languageclient release.