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

Component tags are always highlighted in red (idem like #1172) #1247

Closed
stefaanMLB opened this issue Apr 29, 2022 · 22 comments
Closed

Component tags are always highlighted in red (idem like #1172) #1247

stefaanMLB opened this issue Apr 29, 2022 · 22 comments

Comments

@stefaanMLB
Copy link

Same problem like #1172.
Same thing in the volare-starter project (pulled, not changed in any way)
image

jsx property set as requested in tsconfig.json

"jsx": "preserve"

How can I debug this problem further ?

@plashenkov
Copy link

I have the same problem for "jsx": "preserve" too.

@johnsoncodehk
Copy link
Member

This error is due to missing @vue/runtime-dom because you do not have install node_modules in volare-starter.

@johnsoncodehk johnsoncodehk added the invalid This doesn't seem right label May 3, 2022
@johnsoncodehk
Copy link
Member

@plashenkov Make sure you have put it in compilerOptions, see #1219 (comment).

@stefaanMLB
Copy link
Author

Sorry, no change. Example in starter project, after vscode reload

image
package.json

{
  "name": "volar-starter",
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vue-tsc --noEmit && vite build",
    "serve": "vite preview"
  },
  "dependencies": {
    "vue": "next"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "latest",
    "@volar-plugins/prettier-html": "latest",
    "@vue/compiler-sfc": "latest",
    "@vue/runtime-dom": "^3.2.31",
    "typescript": "latest",
    "vite": "latest",
    "vue-tsc": "latest"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "node",
    "strict": true,
    "jsx": "preserve",
    "sourceMap": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "lib": ["esnext", "dom"],
    "types": ["vite/client"]
  },
  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}

@johnsoncodehk
Copy link
Member

johnsoncodehk commented May 3, 2022

@stefaanMLB Please check if you have disabled editor.semanticHighlighting.enabled in vscode settings, you need to enable it or use configuredByTheme.

螢幕截圖 2022-05-03 21 22 01

@stefaanMLB
Copy link
Author

This was set to configuredByTheme, I changed to true`. This doesn't help.

@johnsoncodehk johnsoncodehk reopened this May 4, 2022
@negipoyoc
Copy link

I have the same problem.

@johnsoncodehk
Copy link
Member

@stefaanMLB Please follow steps.

  1. config "volar.vueserver.useSecondServer": true and "volar-language-features-2.trace.server": "verbose" in volar-starter vscode workspace settings. 螢幕截圖 2022-05-05 12 56 17 螢幕截圖 2022-05-05 12 50 45
  2. Reload vscode window
  3. Open src/App.vue
  4. Open output -> Volar - Second Language Features Server, search Received response 'textDocument/semanticTokens/range and show me the response log. 螢幕截圖 2022-05-05 12 58 56

@negipoyoc
Copy link

@johnsoncodehk
I tried the above Step, but unlike yours, the contents of the "data" is empty.

image

@stefaanMLB
Copy link
Author

@johnsoncodehk thanks for the precise instructions. appreciating it.
I have the search string 5x in the output, so I included some more text just in case. Seems the text you're looking for is in there twice

[Trace - 07:11:35] Received response 'textDocument/semanticTokens/range - (5)' in 3141ms.
Result: {
    "resultId": "1651727495813",
    "data": [
        2,
        3,
        10,
        12,
        0
    ]
}


[Trace - 07:11:35] Received response 'textDocument/documentLink - (7)' in 2502ms.
Result: [
    {
        "range": {
            "start": {
                "line": 1,
                "character": 27
            },
            "end": {
                "line": 1,
                "character": 44
            }
        },
        "target": "file:///c%3A/Users/lcartreul/Documents/projecten/volar-starter/src/assets/logo.png"
    }
]


[Trace - 07:11:35] Received response 'textDocument/codeLens - (8)' in 2455ms.
Result: []


[Trace - 07:11:35] Received response 'textDocument/codeLens - (6)' in 2659ms.
Result: []


[Trace - 07:11:35] Received request 'vue/docVersion - (10)'.
Params: {
    "uri": "file:///c%3A/Users/lcartreul/Documents/projecten/volar-starter/src/App.vue"
}

@johnsoncodehk
Copy link
Member

@negipoyoc Do you have install node_modules of volar-starter?

@stefaanMLB Seems you have correct response data, please try:

  1. Update vscode if it can.
  2. Check what extensions it may affect vue document you have installed and try disable it just keep volar. (Help: Start Extension Bisect command may help)

@stefaanMLB
Copy link
Author

stefaanMLB commented May 6, 2022

@johnsoncodehk
didn't help.
I tried to uninstall and reinstall Volar, I get below error message on every reload
image
I only have these Vue-related extension installed
image

@negipoyoc
Copy link

@johnsoncodehk Hello. Thank you for your answer.

It seems that the data was Empty because I checked the output without resolving the dependency with volar-starter.
After doing the npm install, the Component was highlighted successfully.

I then reviewed the tsconfig.json of my project, which has a similar problem, while looking at the tsconfig.json of volar-starter.

By adding the following to tsconfig.json, I was able to get the highlighting and the problem was resolved in my project.

 "compilerOptions": {
    "jsx": "preserve",
  }

Thank you for addressing the problem despite my simple carelessness.

@yoyo837
Copy link

yoyo837 commented May 12, 2022

Same here.
image

@johnsoncodehk
Copy link
Member

johnsoncodehk commented May 15, 2022

@stefaanMLB For that message, see #1124 (comment).
But I have no clue as to why your component is showing red, the LSP is returning the expected response, the VSCode settings is fine, if it is not the influence of other extensions, it can only be considered a problem with VSCode (but this is the least likely).

@negipoyoc It's ok, I will improve user guidance.

@yoyo837 See #1192.

@johnsoncodehk johnsoncodehk added need info and removed invalid This doesn't seem right labels May 15, 2022
@stefaanMLB
Copy link
Author

@johnsoncodehk I tried disabling any exntensions that could interfere (like vetur), but no luck.
I can live with the problem, I'll try volar out on my home computer which has less extensions installed. Wo't have time in the first few days though.

@tol64
Copy link

tol64 commented May 27, 2022

@johnsoncodehk, created a new project in Nuxt 3 on a virtual machine Windows 10 (VMware). In the editor VSCode installed only one extension - Vue Language Features (Volar).

With Developer: Inspect Editor Tokens And Scopes you can see additional data, how the tag marked in red is interpreted.

2022-05-27_194124

The custom components look the same. In this case, the application is correctly displayed and works in the browser.

With this information in mind, how can I try to solve this problem?

@johnsoncodehk
Copy link
Member

Please update to v0.34.17.

@tol64
Copy link

tol64 commented May 28, 2022

Please update to v0.34.17.

Updated to version v0.35.0 and now everything is correct.
Thank you! 👍

@stefaanMLB
Copy link
Author

Same here, update to v0.35.0 has solved the problem.

@litvinovvo
Copy link

We using explicit components import and now it is hard to see what wasn't imported correctly

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Jul 8, 2022

We using explicit components import and now it is hard to see what wasn't imported correctly

The past behavior was abandoned to resolve the situation in this issue, if you expected the past behavior, please open a new feature request.

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

No branches or pull requests

7 participants