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

[FEATURE] Imports from Anywhere on the FS #593

Closed
4 tasks
georg-schwarz opened this issue Jun 19, 2024 · 5 comments · Fixed by #604
Closed
4 tasks

[FEATURE] Imports from Anywhere on the FS #593

georg-schwarz opened this issue Jun 19, 2024 · 5 comments · Fixed by #604
Assignees
Labels
enhancement New feature or request

Comments

@georg-schwarz
Copy link
Member

georg-schwarz commented Jun 19, 2024

User Story

  1. As a {Jayvee user}
  2. I want {to perform Imports from anywhere of my file system}
  3. So that {model parsing and interpretation don't depend on the current directory (like in Python)}

User Acceptance Criteria

  • Imported documents are dynamically added to the LSP instead of being restricted to a fixed working directory.

See discussion in #590 for more details.

Definitions of Done

  • A PR has been opened and accepted
  • All user acceptance criteria are met
  • All tests are passing
@georg-schwarz
Copy link
Member Author

georg-schwarz commented Jun 20, 2024

Gave it a try to dynamically load files when imported on this branch: https://github.com/jvalue/jayvee/compare/dynamically-load-imported-documents?expand=1

Ran into a roadblock because Langium's ScopeProvider has a synchronous interface. I will open a ticket (eclipse-langium/langium#1554) to determine whether they would be able to make that async in future releases.

@georg-schwarz
Copy link
Member Author

Was pointed to this discussion: eclipse-langium/langium#1308
We should be able to implement it in that way I think.

@rhazn
Copy link
Contributor

rhazn commented Jul 25, 2024

FYI, with Jayvee 0.6.0, importing documents above a model still shows an error in the VSCode extension, e.g. consider the following directories:

a/model.jv
b/shared.jv

If you open model.jv in VSCode, it will show the Import from "./../b/shared.jv" could be resolved. Check if the file exists in the given location.

use {
	Something,
} from "./../b/shared.jv";

If you run model.jv from a, it errors. If you run a/model.jv from the root dir, it works. Not sure if I should create a new bug for this or if it is part of this PR @georg-schwarz ?

@rhazn
Copy link
Contributor

rhazn commented Jul 25, 2024

Actually, the language server part of this might have been a caching (?) issue on my side, seems to work now and not show an error in the jv model. However, the interpreter still errors if run from a.

@georg-schwarz
Copy link
Member Author

Yes, the interpreter and the VSCode plugin take the current directory (where jv is run / the IDE is opened) as basis to load files. That means we cannot link to anything outside of that scope yet.

Quick-fix for now: Start the editor or execute the jv program from a higher directory.

For implementing a more dynamic loading we will have to rework the whole file loading mechanism. Caveat: Auto-complete will never work in that regard.

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

Successfully merging a pull request may close this issue.

2 participants