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

[Multi-file schema / vsCode extension]: Load related schema files into extension context #3063

Open
yannxaver opened this issue Aug 22, 2024 · 5 comments
Assignees

Comments

@yannxaver
Copy link

yannxaver commented Aug 22, 2024

The vsCode extension currently does not seem to be aware of tables and columns defined in other schema files.

Screenshot 2024-08-22 at 09 39 18

My suggestion would be that schema files can be tagged as multi-file, in which case the extension will traverse up the folder tree until it finds an Atlas configuration file. It could then load the other schema files based on env.src. This should enable IntelliSense between multiple files.

@a8m
Copy link
Member

a8m commented Aug 22, 2024

Hey! This should be supported by the latest version of Atlas LSP.

What extension and Atlas versions are you using?

@yannxaver
Copy link
Author

yannxaver commented Aug 22, 2024

Extension v0.5.4

atlas version v0.26.1-a8ccea9-canary
https://github.com/ariga/atlas/releases/latest

edit: upgraded to

atlas version v0.26.1-99a6fcd-canary
https://github.com/ariga/atlas/releases/latest

Still the same error

@a8m a8m assigned giautm and datdao Aug 22, 2024
@giautm
Copy link
Member

giautm commented Aug 22, 2024

@yannxaver : How did you put those files? It should be under same directory to be collected as a module.

@tomcain
Copy link

tomcain commented Aug 22, 2024

The 0.5.4 version of the VS Code Extension doesn't appear to work within a single file either. Auto-completion and linting are not working (altho syntax highlighting seems to be functioning).

Using Windows Atlas EXE Version: atlas version v0.26.1-da6ea25-canary

The last version that appears to work is 0.4.5.

VS Code Version 1.92.2

@yannxaver
Copy link
Author

yannxaver commented Aug 24, 2024

@yannxaver : How did you put those files? It should be under same directory to be collected as a module.

$ find . -type f -name "*.pg.hcl"
./src/postgres/base.pg.hcl
./src/domain/comment/comment.pg.hcl
./src/domain/user/user.pg.hcl

--> not working

$ find . -type f -name "*.pg.hcl"
./src/domain/base.pg.hcl
./src/domain/comment/comment.pg.hcl
./src/domain/user/user.pg.hcl

--> not working

$ find . -type f -name "*.pg.hcl"
./src/domain/base.pg.hcl
./src/domain/user.pg.hcl
./src/domain/comment.pg.hcl

--> working

So it seems like all schema files have to be located in the same folder for the extension to discover them?

For me the primary reason to use multi-file schemas was to co-locate the database schema with other entity-related files in the same folder. Do you have any plans to load schema files into the extension context based on the paths specified in the Atlas configuration file (env.src)? This would allow for a more flexible folder structure.

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

No branches or pull requests

5 participants