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

Create a generic abstraction over all state entities #1627

Open
Tracked by #1614
dbanck opened this issue Feb 12, 2024 · 0 comments
Open
Tracked by #1614

Create a generic abstraction over all state entities #1627

dbanck opened this issue Feb 12, 2024 · 0 comments

Comments

@dbanck
Copy link
Member

dbanck commented Feb 12, 2024


We need to introduce a new way to interacts with variable definition related things, after they've been removed from the Module struct. Access through the module store won't be possible anymore, so we need a new abstraction.

mod, err := svc.modStore.ModuleByPath(dh.Dir.Path())
if err != nil {
if state.IsModuleNotFound(err) {
err = svc.modStore.Add(dh.Dir.Path())
if err != nil {
return err
}
mod, err = svc.modStore.ModuleByPath(dh.Dir.Path())
if err != nil {
return err
}
} else {
return err
}
}

This will allow the LSP handlers (like did_open, did_change) to continue to work as before, but instead of accessing a module directly, they use the abstraction and the language ID to complete the operation, like adding an entity or checking for existence.

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

No branches or pull requests

1 participant