-
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
Need to handle untitled: URI to support Untitled, unsaved files #3343
Comments
It's more than just formatting that isn't working (i.e. no Go to Definition). Saving the file is the workaround. I don't see how we could fix this though -- it's looking like a VS Code limitation. |
There is nothing at the VS Code level stopping code folding from working in unsaved files. This works for C/C++ files in my own extension just fine. |
@akbyrd Our code checks for the scheme == file and languageId == cpp or c before processing files. I don't know how we would get notified that the languageId changed from "plain text" to c or cpp. Also, we may need to change some of the checks to be "|| scheme == untitled". |
I'm not experienced with extensions, but I think all I do is register and vscode does the rest. To verify I disabled the vscode-cpptools folding, enabled mine, opened a new file, pasted some code, set the language to C++ and a few seconds later it updated. It seems to 'just work'. |
@akbyrd The main issue appears to be in our LSP cpptools process, which isn't written correctly to handle input URIs that are not files. So fixing that seems like it would be a non-trivial amount of work. Changing our documentSelectors and scheme checks in TypeScript is the easy part. |
If I open an existed C or CPP file, everything is OK. And the context menu is like this:
However, if I create a new file and select to C or C++ language mode, the context menu will be like this:
And the formatter doesn't work at this time (even though I press Shift+Alt+F).
The text was updated successfully, but these errors were encountered: