-
Notifications
You must be signed in to change notification settings - Fork 418
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
Imports not detected when client sends only textDocument/didOpen
on newly created file (Unity project, neovim client)
#2250
Comments
textDocument/didOpen
on newly created file (Unity project, neovim client)
Having the same issue in Helix. |
Unity projects are Full Framework style projects and require each code file to have a corresponding Edit: After reviewing what happens when the FileChangeWatcher fires, there is a heuristic in O# that will match a new code file to an existing project based on whether the code file exists alongside or beneath the project file on the filesystem. This matching would not persist between sessions unless the project file was updated with the appropriate |
Is this a new file that has been saved and exists on disk?
If the file was added to the filesystem, then I expect that file watchers would need to be updated. |
It's a new file that has not been added to the project. If I'm understanding you correctly then you must regenerate the solution files after the addition of a new file for omnisharp to pick up the imports correctly? It seems to work fine in vscode creating a new file without regenerating the solution file in unity, no errors are thrown (left).
Is it possible that vscode is doing something on each startup that adds this file? It seems like, on further glance, that vscode is not providing completion candidates (or hover) for UnityEngine on the newly added file without regenerating the solution file. |
This comment was marked as duplicate.
This comment was marked as duplicate.
I actually was able to maintain a sustainable workflow by creating a second class (let's say |
A workaround I have found is to add the following line to As mentioned above, each Unity code file needs to have I believe "Regenerate Project Files" button on Unity just ensures there's the I doubt my workaround is going to be a good solution in the long run, mostly because Unity generates this file, which will override the line I've described above. |
I'll test that approach later. |
I've been looking into this in a similar issue for OmniSharp-vim. From what I've seen, I believe omnisharp-vscode has a file watcher watching the .csproj file, and when it is modified (by Unity, which adds a new I've tried to mimic this |
That's great to hear! Is this change on the repo yet? |
Which repo? OmniSharp-vim? Not yet. But I'm just adding it as a command, I was letting you know what my findings were in case you wanted to investigate making that |
Oh... 1 issue may be that OmniSharp-vim doesn't run OmniSharp-roslyn on LSP mode. I'm not sure if omnisharp-vscode has switched to LSP mode either? So I don't know if the |
is it possible to watch the files from nvim and send request when the document is changed and document created for unity i notice the if it possible did the request to server reload all the index ? |
Is there any update to this issue? Adding on to what has been previously said: Another combination I've tested is adding the |
Following the idea from @nickspoons above (with my little knowledge of LSPs) I tried to find if there's a way to make a similar request to this |
@niscolas I finally found something related: neovim/neovim#21293, which is a PR that could be an important factor in finding/creating the solution to the problem. |
@ChimpSpin have you managed to get it working on helix? I see that some people above (#2250 (comment)) have vscode as their configured editor, and it seems it generates some files (seemingly config files) that may be involved in allowing the lsp to work correctly. As a note, I don't even have basic functionality for a single file... so I would really thank you, if you could help me :) |
@0rphee
|
That's super interesting! |
@niscolas thanks, though I forgot to mention that I don't use nvim! I use helix... anyway, maybe I will take a look at the links that you talk about. They may help, thanks! |
@0rphee
|
@ChimpSpin sorry for bothering :( its just that I am a bit lost with this... |
@0rphee
I don't think there was anything else to it. |
@ChimpSpin thank you! and sorry for bothering... |
@niscolas FYI: The linked PR I mentioned 3 weeks ago had been merged into Neovim recently: neovim/neovim#21293. (Haven't tested it though, but definitely usable for Nvim-Unity plugin author.) |
Yay, that's great! |
@nyngwang How would one use this new feature to solve the new file issue? |
Bump, I also wanna know. Kinda a newb in all this. |
I believe that I just got it to work.
|
I only tested this by creating the file through Unity, so I think it automatically adds the file to the |
Hi!
I'm trying to troubleshoot some issues the client I work on has with omnisharp-roslyn, and I was hoping I could ping you all for help.
The issue is, when opening a unity project, say one containing the following file:
Everything is fine, our client detects the imports no problem.
However, the minute we open a new file (for which we send the requisite
textDocument/didOpen
notification) with the exact same content, in the exact same subdirectory, the server returns import error messages:Other servers seem to be fine recognizing new files this way. Do we need to send an additional notification when creating a new file such as
workspace/didChangeWatchedFiles
?The text was updated successfully, but these errors were encountered: