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

[Bug]: Editing source from another (dependency) project within the same workspace is painful #1201

Open
Lucretia opened this issue Jul 24, 2024 · 17 comments
Labels

Comments

@Lucretia
Copy link

Environment

  • OS and Version: Gentoo
  • IDE Version: Version: 1.91.0-insider
    Commit: b36286db80c68b7fdc6bfee2f55e0208c8833dfc
    Date: 2024-06-25T09:17:37.767Z
    Electron: 29.4.0
    ElectronBuildId: 9728852
    Chromium: 122.0.6261.156
    Node.js: 20.9.0
    V8: 12.2.281.27-electron.0
    OS: Linux x64 6.8.8-gentoo-x86_64
  • Ada & SPARK Extension Version: 24.0.6 (2024-06-25)

Bug Summary and Reproducer

Bug Summary: Keep getting failure popups and crash logs to console

Steps to reproduce: Create a workspace, set the project gpr to the main project, add dependencies, edit source from dependency.

Expected behavior: I expect it to work as normal.

Configuration and Logs

... (too much to log)
[Error - 00:10:25] Request textDocument/documentSymbol failed.
Error: selectionRange must be contained in fullRange
	at f.validate (/home/laguest/opt/VSCode-linux-x64/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:18197)
	at new f (/home/laguest/opt/VSCode-linux-x64/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:18411)
	at qt (/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/out/src/extension.js:65:72241)
	at qt (/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/out/src/extension.js:65:72418)
	at o (/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/out/src/extension.js:65:46654)
	at Object.WL [as map] (/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/out/src/extension.js:65:46740)
	at Object.yr [as asDocumentSymbols] (/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/out/src/extension.js:65:72208)
	at u (/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/out/src/extension.js:69:56048)
	at async f.provideDocumentSymbols (/home/laguest/opt/VSCode-linux-x64/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:154:98866)
[Error - 00:14:45] Request textDocument/documentSymbol failed.
Error: selectionRange must be contained in fullRange
	at f.validate (/home/laguest/opt/VSCode-linux-x64/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:18197)
	at new f (/home/laguest/opt/VSCode-linux-x64/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:18411)
	at qt (/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/out/src/extension.js:65:72241)
	at qt (/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/out/src/extension.js:65:72418)
	at o (/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/out/src/extension.js:65:46654)
	at Object.WL [as map] (/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/out/src/extension.js:65:46740)
	at Object.yr [as asDocumentSymbols] (/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/out/src/extension.js:65:72208)
	at u (/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/out/src/extension.js:69:56048)
	at async f.provideDocumentSymbols (/home/laguest/opt/VSCode-linux-x64/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:154:98866)

Other VS Code Extensions

No response

Additional context

No response

@Lucretia Lucretia added the bug label Jul 24, 2024
@AnthonyLeonardoGracio
Copy link
Collaborator

Hello @Lucretia,

It would be useful to have the logs of the Ada Language Server itself, in order to know what the server's response on textDocument/symbol request. For that, just create a ~/.als/traces.cfg file with the following contents:

>ada_ls_log.$T.log:buffer_size=0
ALS.MAIN=yes
ALS.IN=yes
ALS.OUT=yes

This will produce ada_ls_log.<timestamp>.log files for each Ada Language Server instance that is launched (one for Ada code, another one for GPR files). Could you try to reproduce the failures once you have created this traces.cfg file and send us the logs?

Regards,

@Lucretia
Copy link
Author

Lucretia commented Jul 26, 2024

You might want to look near the end as it wasn't until then I tried F12 on the GL.Convert symbol, which is from another project in the workspace.

You can find the source here. I've been working from the ch2/<dir> project dirs.

als-logs.zip

@AnthonyLeonardoGracio
Copy link
Collaborator

Hello,

In one of the logs I see:

[ALS.MAIN] GPR2.PROJECT_ERROR - /home/laguest/src/mine-new/self-learning/cgpiogl/ch2/2.4_files/./filesgpr: fatal error, cannot load the project tree
[ALS.MAIN] [/home/laguest/.vscode-insiders/extensions/adacore.ada-24.0.6/x64/linux/ada_language_server]
...
[ALS.MAIN] /home/laguest/src/mine-new/self-learning/cgpiogl/ch2/2.4_files/./filesgpr project file "/home/laguest/src/mine-new/self-learning/cgpiogl/ch2/2.4_files/./filesgpr" not found

So it seems that the path your have specified for ada.projectFile does not exit (at least the server does not find it). I would suggest to double-check that first, it might be the primary cause for the requests' failures.

Regards,

@Lucretia
Copy link
Author

Yeah, I fixed that. But the error I reported was NOT on that project, it was on the earlier ones, where the GPR file was correct.

@Lucretia
Copy link
Author

Lucretia commented Jul 26, 2024

I suggest you grab my sources, add sdl, then open the ch2/<project>/.vscode/?.code-workspace then try to edit gl.ads, just add something at the end. You'll get no end of popups with errors in them.

@AnthonyLeonardoGracio
Copy link
Collaborator

I am missing a lot of dependencies in order to properly load your sources, it would be great if you could attach a self-contained archive, or at least tell me how to grab all the missing dependencies.

@Lucretia
Copy link
Author

You don't need sdlada_image, just delete that from toml.

You can uncomment the url line for sdlada and it should build, that is the only dependency. The opengl source is within the same repo, ../../ back.

@AnthonyLeonardoGracio
Copy link
Collaborator

And where can I find with "config/first_config.gpr";, which is included for instance in ch2/2.1_first/first.gpr ?

@Lucretia
Copy link
Author

That's generated by alire.

@AnthonyLeonardoGracio
Copy link
Collaborator

It still fails after uncommenting the sdlada line and doing alr build. Please provide a smaller reproducer, either based on Alire or not, but that works from scratch: it will make debugging way easier for us.

@Lucretia
Copy link
Author

Did you remove the other sdlada line with the path?

@Lucretia
Copy link
Author

An easier way for you to test is to create a project, open it in vscode, add a dependency and then add that dependency as a folder within the workspace, then try to get any kind of assistance, auto-complete, go to symbol, etc. Won't work.

@AnthonyLeonardoGracio
Copy link
Collaborator

An easier way for you to test is to create a project, open it in vscode, add a dependency and then add that dependency as a folder within the workspace, then try to get any kind of assistance, auto-complete, go to symbol, etc. Won't work.

Add a dependency in the Alire .toml file?

@Lucretia
Copy link
Author

Lucretia commented Sep 2, 2024

In my case it was a dependency on the project added to the workspace, so I could edit that at the same time.

@AnthonyLeonardoGracio
Copy link
Collaborator

In my case it was a dependency on the project added to the workspace, so I could edit that at the same time.

if you add anew dependency you should reload the project from VS Code, otherwise the navigation won't work: this is expected. Also you should make sure to set the ada.projectFile setting, in order to specify what root project the Ada Language Server should use if there are multiple .gpr files in the same workspace

@Lucretia
Copy link
Author

Lucretia commented Sep 2, 2024

This isn't hard. Just try it. Create a project, add sdlada (or some other project) as a dependency, then add them both into the workspace, and set the gpr profect in settings, try editing the project which isn't the main one.

@AnthonyLeonardoGracio
Copy link
Collaborator

AnthonyLeonardoGracio commented Sep 2, 2024

If we ask for a detailed reproducer it's because what you are describing works fine in usual cases, as you can see in the attached screenshot: here I have a default.gpr root project (located in a folder called basic_prj) that imports a to_import.gpr project file located in another directory (../to_import). I have then added the imported project's source directory in my workspace as you have described (via the Ada: Add Missing Source Directories To Worskpace command).

Screenshot 2024-09-02 at 11 59 17

I can perfectly edit the imported project's sources: I have completion, tooltips and all other expected features. So there must be something specific with your configuration: having a proper reproduced with detailed steps (or a self containex archive) would greatly help. I understand that it's some work for you and I am very sorry for that, but it would be hard to solve that issue otherwise.

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

No branches or pull requests

2 participants