-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add UI to provide args for templates, to enable template IntelliSense #1946
Comments
I'm also able to repro this bug with VS 2017, so I'll look into filing a bug with them and update this issue when I get more info... |
Thanks, @sean-mcmanus . |
It turns out this is a "by design" limitation -- templates have errors turned off, because the type info is not known for the template args. We would have to add some UI that enables users to set the actual types of the template args. |
VS added the feature in 15.8: https://devblogs.microsoft.com/cppblog/template-intellisense/ . |
@sean-mcmanus I think you can bring this iteratively - even without a UI you can do this as a feasible solution. Setting the template argument manually (e.g. using default value, or by adding a comment with a predefined format) could at least help initial authoring and debugging tremendously.I for one would certainly be open to adding a default value temporarily, or adding a comment before/after the template declaration just to get autocompletion, error highlighting, etc. Since concepts will be added in C++20, you can also use those. Adding a UI is certainly the long-term solution (GitLens adds so much information I think there could be a potential solution in a similar component), but if that's the toughest part, let's workaround that :) |
Any schedule about that yet? |
@drunkenmastah Not yet...if it gets on our schedule, you'll see it added to a specific Milestone and/or Project instead of the "Backlog" milestone. |
Is there any way to make this issue higher priority to get solved? It seems like this issue has been lying around for quite a while, and the lack of IntelliSense really slows down implementation compared to when IntelliSense is working. |
@Rishi-V You could try asking @bobbrow if there's any ETA estimate. It is number 11 when sorted by upvotes: https://github.com/Microsoft/vscode-cpptools/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3A%22Language+Service%22 . |
@sean-mcmanus Can the "bug" tag be added to this issue? I feel like the current |
@Rishi-V We could potentially add the bug tag, but it doesn't have any impact on anything in terms of the priority. The "bug" versus "enhancement" versus "feature request" tags are mostly just used when determine which section to place it in the changelog (https://github.com/microsoft/vscode-cpptools/blob/main/Extension/CHANGELOG.md) and there is lots of precedence for "feature request" and "enhancement" type issues that could be considered bugs as well, but from our perspective we could consider them not a bug due to the amount of work involved in implementing it and the fact that the buggy behavior is a direct result of a case not being implemented. Also, in this particular case, if the VS UI isn't used to set the T, then the "buggy" behavior still occurs, but the VS team doesn't consider it a bug. And also, if it's placed in the bug section of our changelog then it would tend to be "lost" among the many other bug fixes while we'd want such a major improvement to be more easily noticed in our "New Features" section, and we'd probably blog about it too. |
I don't have an estimate as to when this feature will be implemented. When we know, we will assign it to a project. |
There are some syntax errors that do not depend on type yet those aren't detected. I think at least that part should be fixed first. |
Dear vscode-powers-that-be, this is much, much needed. What will it take to prioritize this? Any rudimentary solution (if UI is complicated) is welcome. Templates are getting to be a huge pain in VSCode, tempting me to fall back to VStudio. |
I don't think anything can be done to increase the priority other than
wait. If it really bothers you, and other remedies here don't work for you,
you can try using the extension clangd instead of the vscode one. The
intellisense feedback is also faster and more responsive 😁
…On Fri, 6 Jan 2023, 09:04 ssg, ***@***.***> wrote:
Dear vscode-powers-that-be, this is much, much needed. What will it take
to prioritize this? Any rudimentary solution (if UI is complicated) is
welcome. Templates are getting to be a huge pain in VSCode, tempting me to
fall back to VStudio.
—
Reply to this email directly, view it on GitHub
<#1946 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKYNEOH2RZZOBQ3CP6LV46TWQ7NYDANCNFSM4E6RYZEA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
You say there are "other remedies", could you point me to those? I did scour the page here to look for workarounds before posting, but maybe I missed spotting them. |
@ssg3d Depending on the templated code, you could potentially temporarily replace the templated code with specific types. |
Related question asked on Stack Overflow: Why doesn't Intellisense provide suggestions for templates inside templates that use parameters from the outer template? |
Surprised it is still in backlog and not been taken up. I thought templates are more heavily used by programmers today and this would get a higher priority. |
Any ETA when this will be implemented? The current UX in VS Code when working with templated code is horrible :( |
I'm surprised this still hasn't been implemented. Templates are a massive part of C++ and having such a feature on the backlog makes the extension quite undesirable, so as I said before I use clangd from now on for any C++ work in vscode which supports templates. |
I'm sorry if you're getting spammed with requests for feedback. We don't control this experience, the VS Code team does, but if you're hitting a problem here, it means others are too. Would you be willing to help provide information to the VS Code team if we (or you) open an issue in their repo? It is not our intent to annoy people with survey requests and there's supposed to be a mechanism to prevent that. Do you happen to be using Codespaces or Remote SSH to connect to various Virtual Machines? I believe each of those get a unique id and might be considered as separate users. |
|
I'm sorry I don't have an ETA for this feature right now. When it is added to a milestone/project, that means we have a target date set for it. |
Using Clion but would happily move to VSCode if this feature was implemented |
Is there any update on this feature yet? this is the main thing stopping me from completely switching to VSCode for everything. |
This issue inspired me to look for alternatives. |
Yeah, clangd handles templates a lot better than the vscode extension and doesn't just outright refuse to lint any code with the template keyword - although it's not perfect, it still doesn't catch a lot of errors, but it usually catches them all in the end when you instantiate the template in code. |
@SpeedyCraftah cpptools doesn't do that for you? Because I'm pretty sure it should. At least- it does for me when using CMake Tools as the configuration provider. |
Seconding this. Just tried out |
MacOS 10.13.4
VSCode 1.24.0-Insiders #2404210629c744e6237a14d7b5fa852e24c6e898
0.16.1
Create at least one class declaration in a header file.
Use a template on this class
Intentionally create a syntax error
Note that no error squiggles are generated and no error or warning given in the Problems pane.
In the example below, I am showing quite a few compiler errors (there are plenty in this file). One in particular is the errant use of override. This shows up in the compiler output, but not in the error squiggles or in the Problems pane:
Errant header file attached
LinkedList.h.zip
The logs indicate that it thinks it is looking for syntax errors:
IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don't resolve.
Autocomplete is enabled.
Error squiggles are enabled.
File exclude: **/.git
File exclude: **/.svn
File exclude: **/.hg
File exclude: **/CVS
File exclude: **/.DS_Store
File exclude: **/.o
File exclude: **/.d
File exclude: **/.vscode
Search exclude: **/node_modules
Search exclude: **/bower_components
Search exclude: **/.vscode
Code browsing service initialized
Folder: /usr/local/include/ will be indexed
Folder: /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ will be indexed
Folder: /Users/dustinlane/Desktop/VSCode_Test/ will be indexed
Folder: /System/Library/Frameworks/ will be indexed
Folder: /Library/Frameworks/ will be indexed
Discovering files...
Checking for syntax errors: file:///Users/dustinlane/Desktop/VSCode_Test/C%2B%2B_Test/LinkedList.h
Processing folder (recursive): /usr/local/include/
Processing folder (recursive): /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/
Processing folder (recursive): /Users/dustinlane/Desktop/VSCode_Test/
Processing folder (recursive): /System/Library/Frameworks/
Checking for syntax errors: file:///Users/dustinlane/Desktop/VSCode_Test/C%2B%2B_Test/LinkedList.h
Checking for syntax errors: file:///Users/dustinlane/Desktop/VSCode_Test/C%2B%2B_Test/LinkedList.h
Checking for syntax errors: file:///Users/dustinlane/Desktop/VSCode_Test/C%2B%2B_Test/LinkedList.cpp
Shutting down IntelliSense server: /Users/dustinlane/Desktop/VSCode_Test/C++_Test/main.cpp
Checking for syntax errors: file:///Users/dustinlane/Desktop/VSCode_Test/C%2B%2B_Test/LinkedList.h
Checking for syntax errors: file:///Users/dustinlane/Desktop/VSCode_Test/C%2B%2B_Test/LinkedList.h
Processing folder (recursive): /Library/Frameworks/
Discovering files: 301712 file(s) processed
0 file(s) removed from database
Done discovering files.
Parsing open files...
Parsing remaining files...
Parsing: 0 files(s) processed
Done parsing remaining files.
Done parsing open files.
Checking for syntax errors: file:///Users/dustinlane/Desktop/VSCode_Test/C%2B%2B_Test/main.cpp
Checking for syntax errors: file:///Users/dustinlane/Desktop/VSCode_Test/C%2B%2B_Test/LinkedList.h
The text was updated successfully, but these errors were encountered: