Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Quick fixes are not availabe at the start of the error/warn message #411

Open
1 of 3 tasks
kolchurinvv opened this issue Oct 22, 2024 · 3 comments
Open
1 of 3 tasks
Labels

Comments

@kolchurinvv
Copy link

kolchurinvv commented Oct 22, 2024

VS Code version

1.94.2

Extension version

2.3.0

Biome version

1.9.4

Operating system

  • Windows
  • macOS
  • Linux

Description

VS Code:

Version: 1.94.2
Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427
Date: 2024-10-09T16:08:44.566Z
Electron: 30.5.1
ElectronBuildId: 10262041
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 24.0.0

Description

Quickfixes don’t show up when the cursor is on the first character of a problem reported to diagnostic messages, however further in the problematic string the quickfix appears. Also, this is preventing VSCode from picking up quickfixes into the ‘auto fix’ and ‘fix all’ commands (command pallet)
output

Steps to reproduce

  1. go to any file (in my case .js)
  2. press alt+f8 to go to the next problem in file
  3. press cmd + . to open quickfix menu
  4. observe the biome quickfix missing
  5. move one character to the right
  6. press cmd + . again
  7. observe biome quick fixes

Expected behavior

in step 3; biome quick fixes should be visible

Does this issue occur when using the CLI directly?

Not sure / Not applicable

Link to a minimal reproduction

No response

Logs

[Trace - 12:15:14] Sending request 'textDocument/codeAction - (49)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/vladimir/Dev_Projects/Snapshot-docker/web/app/src/utils/createReport.js"
    },
    "range": {
        "start": {
            "line": 286,
            "character": 52
        },
        "end": {
            "line": 286,
            "character": 52
        }
    },
    "context": {
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 286,
                        "character": 52
                    },
                    "end": {
                        "line": 286,
                        "character": 90
                    }
                },
                "message": "Template literals are preferred over string concatenation.",
                "code": "lint/style/useTemplate",
                "codeDescription": {
                    "href": "https://biomejs.dev/linter/rules/use-template"
                },
                "severity": 1,
                "source": "biome"
            }
        ],
        "triggerKind": 2
    }
}


[Trace - 12:15:14] Received response 'textDocument/codeAction - (49)' in 12ms.
Result: [
    {
        "title": "Organize Imports (Biome)",
        "kind": "source.organizeImports.biome",
        "edit": {
            "changes": {
                "file:///Users/vladimir/Dev_Projects/Snapshot-docker/web/app/src/utils/createReport.js": [
                    {
                        "range": {
                            "start": {
                                "line": 0,
                                "character": 19
                            },
                            "end": {
                                "line": 0,
                                "character": 19
                            }
                        },
                        "newText": "Font, Image, "
                    },
                    {
                        "range": {
                            "start": {
                                "line": 0,
                                "character": 47
                            },
                            "end": {
                                "line": 0,
                                "character": 55
                            }
                        },
                        "newText": ""
                    },
                    {
                        "range": {
                            "start": {
                                "line": 0,
                                "character": 56
                            },
                            "end": {
                                "line": 0,
                                "character": 61
                            }
                        },
                        "newText": ""
                    },
                    {
                        "range": {
                            "start": {
                                "line": 3,
                                "character": 7
                            },
                            "end": {
                                "line": 3,
                                "character": 11
                            }
                        },
                        "newText": "logo_dark"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 3,
                                "character": 36
                            },
                            "end": {
                                "line": 3,
                                "character": 44
                            }
                        },
                        "newText": "leaf.png"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 4,
                                "character": 7
                            },
                            "end": {
                                "line": 4,
                                "character": 16
                            }
                        },
                        "newText": "logo"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 4,
                                "character": 41
                            },
                            "end": {
                                "line": 4,
                                "character": 49
                            }
                        },
                        "newText": "logo.png"
                    }
                ]
            }
        },
        "isPreferred": true
    }
]


[Trace - 12:15:15] Sending request 'textDocument/codeAction - (50)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/vladimir/Dev_Projects/Snapshot-docker/web/app/src/utils/createReport.js"
    },
    "range": {
        "start": {
            "line": 286,
            "character": 52
        },
        "end": {
            "line": 286,
            "character": 52
        }
    },
    "context": {
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 286,
                        "character": 52
                    },
                    "end": {
                        "line": 286,
                        "character": 90
                    }
                },
                "message": "Template literals are preferred over string concatenation.",
                "code": "lint/style/useTemplate",
                "codeDescription": {
                    "href": "https://biomejs.dev/linter/rules/use-template"
                },
                "severity": 1,
                "source": "biome"
            }
        ],
        "triggerKind": 1
    }
}


[Trace - 12:15:16] Received response 'textDocument/codeAction - (50)' in 14ms.
Result: [
    {
        "title": "Organize Imports (Biome)",
        "kind": "source.organizeImports.biome",
        "edit": {
            "changes": {
                "file:///Users/vladimir/Dev_Projects/Snapshot-docker/web/app/src/utils/createReport.js": [
                    {
                        "range": {
                            "start": {
                                "line": 0,
                                "character": 19
                            },
                            "end": {
                                "line": 0,
                                "character": 19
                            }
                        },
                        "newText": "Font, Image, "
                    },
                    {
                        "range": {
                            "start": {
                                "line": 0,
                                "character": 47
                            },
                            "end": {
                                "line": 0,
                                "character": 55
                            }
                        },
                        "newText": ""
                    },
                    {
                        "range": {
                            "start": {
                                "line": 0,
                                "character": 56
                            },
                            "end": {
                                "line": 0,
                                "character": 61
                            }
                        },
                        "newText": ""
                    },
                    {
                        "range": {
                            "start": {
                                "line": 3,
                                "character": 7
                            },
                            "end": {
                                "line": 3,
                                "character": 11
                            }
                        },
                        "newText": "logo_dark"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 3,
                                "character": 36
                            },
                            "end": {
                                "line": 3,
                                "character": 44
                            }
                        },
                        "newText": "leaf.png"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 4,
                                "character": 7
                            },
                            "end": {
                                "line": 4,
                                "character": 16
                            }
                        },
                        "newText": "logo"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 4,
                                "character": 41
                            },
                            "end": {
                                "line": 4,
                                "character": 49
                            }
                        },
                        "newText": "logo.png"
                    }
                ]
            }
        },
        "isPreferred": true
    }
]


[Trace - 12:15:17] Sending request 'textDocument/codeAction - (51)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/vladimir/Dev_Projects/Snapshot-docker/web/app/src/utils/createReport.js"
    },
    "range": {
        "start": {
            "line": 286,
            "character": 53
        },
        "end": {
            "line": 286,
            "character": 53
        }
    },
    "context": {
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 286,
                        "character": 52
                    },
                    "end": {
                        "line": 286,
                        "character": 90
                    }
                },
                "message": "Template literals are preferred over string concatenation.",
                "code": "lint/style/useTemplate",
                "codeDescription": {
                    "href": "https://biomejs.dev/linter/rules/use-template"
                },
                "severity": 1,
                "source": "biome"
            }
        ],
        "triggerKind": 2
    }
}


[Trace - 12:15:17] Received response 'textDocument/codeAction - (51)' in 20ms.
Result: [
    {
        "title": "Suppress rule lint/style/useTemplate",
        "kind": "quickfix.suppressRule.biome",
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 286,
                        "character": 52
                    },
                    "end": {
                        "line": 286,
                        "character": 90
                    }
                },
                "severity": 1,
                "code": "lint/style/useTemplate",
                "codeDescription": {
                    "href": "https://biomejs.dev/linter/rules/use-template"
                },
                "source": "biome",
                "message": "Template literals are preferred over string concatenation."
            }
        ],
        "edit": {
            "changes": {
                "file:///Users/vladimir/Dev_Projects/Snapshot-docker/web/app/src/utils/createReport.js": [
                    {
                        "range": {
                            "start": {
                                "line": 286,
                                "character": 12
                            },
                            "end": {
                                "line": 286,
                                "character": 12
                            }
                        },
                        "newText": "{/* biome-ignore lint/style/useTemplate: <explanation> */}\n            "
                    }
                ]
            }
        }
    },
    {
        "title": "Use a template literal.",
        "kind": "quickfix.biome",
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 286,
                        "character": 52
                    },
                    "end": {
                        "line": 286,
                        "character": 90
                    }
                },
                "severity": 1,
                "code": "lint/style/useTemplate",
                "codeDescription": {
                    "href": "https://biomejs.dev/linter/rules/use-template"
                },
                "source": "biome",
                "message": "Template literals are preferred over string concatenation."
            }
        ],
        "edit": {
            "changes": {
                "file:///Users/vladimir/Dev_Projects/Snapshot-docker/web/app/src/utils/createReport.js": [
                    {
                        "range": {
                            "start": {
                                "line": 286,
                                "character": 52
                            },
                            "end": {
                                "line": 286,
                                "character": 52
                            }
                        },
                        "newText": "`${"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 286,
                                "character": 67
                            },
                            "end": {
                                "line": 286,
                                "character": 67
                            }
                        },
                        "newText": "}"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 286,
                                "character": 68
                            },
                            "end": {
                                "line": 286,
                                "character": 76
                            }
                        },
                        "newText": "${"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 286,
                                "character": 90
                            },
                            "end": {
                                "line": 286,
                                "character": 90
                            }
                        },
                        "newText": "}`"
                    }
                ]
            }
        }
    }
]


[Trace - 12:15:18] Sending request 'textDocument/codeAction - (52)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/vladimir/Dev_Projects/Snapshot-docker/web/app/src/utils/createReport.js"
    },
    "range": {
        "start": {
            "line": 286,
            "character": 53
        },
        "end": {
            "line": 286,
            "character": 53
        }
    },
    "context": {
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 286,
                        "character": 52
                    },
                    "end": {
                        "line": 286,
                        "character": 90
                    }
                },
                "message": "Template literals are preferred over string concatenation.",
                "code": "lint/style/useTemplate",
                "codeDescription": {
                    "href": "https://biomejs.dev/linter/rules/use-template"
                },
                "severity": 1,
                "source": "biome"
            }
        ],
        "triggerKind": 1
    }
}


[Trace - 12:15:18] Received response 'textDocument/codeAction - (52)' in 13ms.
Result: [
    {
        "title": "Suppress rule lint/style/useTemplate",
        "kind": "quickfix.suppressRule.biome",
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 286,
                        "character": 52
                    },
                    "end": {
                        "line": 286,
                        "character": 90
                    }
                },
                "severity": 1,
                "code": "lint/style/useTemplate",
                "codeDescription": {
                    "href": "https://biomejs.dev/linter/rules/use-template"
                },
                "source": "biome",
                "message": "Template literals are preferred over string concatenation."
            }
        ],
        "edit": {
            "changes": {
                "file:///Users/vladimir/Dev_Projects/Snapshot-docker/web/app/src/utils/createReport.js": [
                    {
                        "range": {
                            "start": {
                                "line": 286,
                                "character": 12
                            },
                            "end": {
                                "line": 286,
                                "character": 12
                            }
                        },
                        "newText": "{/* biome-ignore lint/style/useTemplate: <explanation> */}\n            "
                    }
                ]
            }
        }
    },
    {
        "title": "Use a template literal.",
        "kind": "quickfix.biome",
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 286,
                        "character": 52
                    },
                    "end": {
                        "line": 286,
                        "character": 90
                    }
                },
                "severity": 1,
                "code": "lint/style/useTemplate",
                "codeDescription": {
                    "href": "https://biomejs.dev/linter/rules/use-template"
                },
                "source": "biome",
                "message": "Template literals are preferred over string concatenation."
            }
        ],
        "edit": {
            "changes": {
                "file:///Users/vladimir/Dev_Projects/Snapshot-docker/web/app/src/utils/createReport.js": [
                    {
                        "range": {
                            "start": {
                                "line": 286,
                                "character": 52
                            },
                            "end": {
                                "line": 286,
                                "character": 52
                            }
                        },
                        "newText": "`${"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 286,
                                "character": 67
                            },
                            "end": {
                                "line": 286,
                                "character": 67
                            }
                        },
                        "newText": "}"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 286,
                                "character": 68
                            },
                            "end": {
                                "line": 286,
                                "character": 76
                            }
                        },
                        "newText": "${"
                    },
                    {
                        "range": {
                            "start": {
                                "line": 286,
                                "character": 90
                            },
                            "end": {
                                "line": 286,
                                "character": 90
                            }
                        },
                        "newText": "}`"
                    }
                ]
            }
        }
    }
]
@ematipico
Copy link
Member

Can you at least provide a snippet that we can use for debugging your issue?

@kolchurinvv
Copy link
Author

kolchurinvv commented Oct 22, 2024

certainly

function parseTxt(txt) {
  return "some prepended text" + txt
}

export default { parseTxt }

output2

@kolchurinvv
Copy link
Author

i have this issue in any ts/js file. i have a biome.json in the root folder of the project and it’s being picked up. the linter and formatter rules apply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants