microsoft / microsoft/vscode-html-languageservice
Invalid error message: "Cannot redeclare block-scoped variable"
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 284
- Forks
- 138
- Avg merge
- 19h 11m
- Merged PRs (30d)
- 5
Description
- Issue Type:
Bug - Extension Name:
html-language-features - Extension Version:
1.0.0 - OS Version:
Linux x64 5.15.0-46-generic - VS Code version:
1.70.2
{
"messages": [],
"activationTimes": {
"codeLoadingTime": 16,
"activateCallTime": 5,
"activateResolvedTime": 360,
"activationReason": {
"startup": false,
"extensionId": {
"value": "vscode.html-language-features",
"_lower": "vscode.html-language-features"
},
"activationEvent": "onLanguage:html"
}
},
"runtimeErrors": [],
"runningLocation": {
"affinity": 0,
"kind": 1
}
}
When using this html code:
<script type="module">let a = 0;</script>
<script type="module">let a = 0;</script>
Problems tab reads: Cannot redeclare block-scoped variable 'a'.
Since I'm using module scripts the two variables live in isolated scopes.
However, the error message is valid for classic scripts:
<script>let a = 0;</script>
<script>let a = 0;</script>
The same issue arises when mixing both script types:
<script type="module">let a = 0;</script>
<script>let a = 0;</script>
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported diagnostics in the html-language-features service using the module, classic, and mixed script examples from the issue. Trace the HTML script-block validation entry point and adjust the scope handling so separate module scripts do not conflict, while classic and mixed cases retain the appropriate redeclaration diagnostic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100