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

Invalid error message: "Cannot redeclare block-scoped variable" #133

Open
johnnygerard opened this issue Aug 18, 2022 · 2 comments · May be fixed by microsoft/vscode#171547
Open

Invalid error message: "Cannot redeclare block-scoped variable" #133

johnnygerard opened this issue Aug 18, 2022 · 2 comments · May be fixed by microsoft/vscode#171547

Comments

@johnnygerard
Copy link

  • 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>
@davepeck
Copy link

davepeck commented Apr 17, 2024

@johnnygerard Is there a reason you marked this as completed? It still happens for me in vscode and it seems like a pretty clear bug. I do notice an equivalent bug, still open, in the vscode repo itself.

@johnnygerard johnnygerard reopened this Apr 18, 2024
@johnnygerard
Copy link
Author

@davepeck I should have kept it open for others, my bad.

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

Successfully merging a pull request may close this issue.

2 participants