0.0.4 • Published 6 years ago

resharper-vs-code-bridge v0.0.4

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

ReSharper -> VS Code Bridge

This is an extremely shabby attempt at getting ReSharper's inspections into Visual Studio Code now that JetBrains have expressed no interest in bringing ReSharper across officially.

Usage

  1. Install as a dev dependency: npm i -D resharper-vs-code-bridge
  2. Download the ReSharper Command Line Tools from https://www.jetbrains.com/resharper/download/#section=resharper-clt
  3. Extract the tools to a known location and add that directory to your system's PATH variable. Note: This must be added to either the system's PATH or the PATH of the user that runs your VS Code tasks
  4. Add a task to your .vscode\tasks.json as follows:
{
    "label": "inspect",
    "command": "node",
    "type": "process",
    "args": [
        "node_modules\\resharper-vs-code-bridge",
        "MySolution.sln"
    ],
    "problemMatcher": {
        "owner": "resharper-vs-code-bridge",
        "fileLocation": [
            "relative",
            "${workspaceFolder}"
        ],
        "pattern": {
            "regexp": "Code=\"(.+?)\" Severity=\"(.+?)\" File=\"(.+?)\" Line=\"(.+?)\" Message=\"(.+?)\"",
            "code": 1,
            "severity": 2,
            "file": 3,
            "line": 4,
            "message": 5
        }
    }
}
  1. Run the inspect task from the Tasks -> Run Task... menu in VS Code

How it works

The task itself simply runs the resharper-vs-code-bridge NodeJS package, listens for output on STDOUT and then parses it with the provided regex pattern in order to extract code inspection issues and pass them to the IDE.

The package takes one required argument and another optional one. For example:

node node_modules\\resharper-vs-code-bridge MySolution.sln InspectCode.exe

Where:

  • MySolution.sln is a required argument defining the path to the solution to inspect relative to the root of your workspace
  • InspectCode.exe is an optional argument (default value is InspectCode.exe) that defines where the package can find ReSharper's executable. This is not required if the PATH was set up as explained above.

The package then does the following:

  1. Runs InspectCode.exe for the solution you defined and outputs the report as a temporary XML file in the root of your workspace
  2. Reads and parses this temporary report in order to collate metadata about each issue into a more suitable format for output to VS Code
  3. Removes the temporary report file
  4. Outputs the modified report onto STDOUT in the format specified in the task's pattern
  5. VS Code then reads this output, runs the regex against it and ends up with a list of inspection issues that it can display in the IDE

Known Limitations

  • It's far too slow for any automated approach, because of this I've not put any effort into writing an extension to run the inspections automatically as you code
  • Resulting inspection issues do not expose the exact columns of the errors, instead you'll see a squiggly across the whole line. More fine grained reporting is possible, but has not been implemented in this MVP
  • No support for specifying the minimum severity ReSharper will report on, currently it will show Suggestions and upwards (i.e. hints are ignored)
0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago