Skip to content

Convert function into ES2015 class quickfix returns empty result聽#33600

Description

@mjbvz

From microsoft/vscode#81409

TypeScript Version: 3.7.0-dev.20190924

Search Terms:

  • code action
  • quick fix
  • convert function to class
  • tsserver
  • getCodeFixes

Code
For the js

(function() {
    let x = () => {
        this.y = 1;
    };
})();

Try running the suggested convert function into class refactoring

Bug:
Nothing happens.

This is because TS Server returns a response with no changes:

[Trace  - 10:43:25 AM] <semantic> Sending request: getCodeFixes (45). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/index.js",
    "startLine": 1,
    "startOffset": 2,
    "endLine": 1,
    "endOffset": 10,
    "errorCodes": [
        80002
    ]
}
[Trace  - 10:43:25 AM] <semantic> Response received: getCodeFixes (45). Request took 1 ms. Success: true 
Result: [
    {
        "fixName": "convertFunctionToEs6Class",
        "description": "Convert function to an ES2015 class",
        "changes": [],
        "fixId": "convertFunctionToEs6Class",
        "fixAllDescription": "Convert all constructor functions to classes"
    }
]

I believe we can filter this out on the VS Code side but it is odd that this result is included

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbol

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions