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

Search the scope of imported libraries #2701

Open
1 of 5 tasks
andreasabel opened this issue Aug 17, 2017 · 4 comments
Open
1 of 5 tasks

Search the scope of imported libraries #2701

andreasabel opened this issue Aug 17, 2017 · 4 comments
Labels
scope Issues relating to scope checking type: enhancement Issues and pull requests about possible improvements ux: error reporting Issues to do with how Agda reports errors ux: library management Issues relating to the library management system
Milestone

Comments

@andreasabel
Copy link
Member

andreasabel commented Aug 17, 2017

Now that we have the .agda-lib files, we could use the libraries to improve the NotInScope error to also list hits in the non-imported files of the libraries in the project.

Steps to make this work:

  • get all the source files of a library.
    This could either be directory search, or we agree on a convention that if Everything.agda or README.agda are present, then only this file is used (and recursively its imports). We could also add to the library description a "main" file which imports everything in the library.

  • Deserialize only the scope of the interface files. This requires some skrewing with the import logic or the deserializer.

  • Keep the deserialized scopes in a separate ScopeInfo structure, allowing ambiguities.

  • Query this ScopeInfo for names that are not in scope, or similar ones. We already have this functionality for the current scope.

  • We might have to worry about a lot of false positives. Maybe for things from the libraries which are not in scope, we should only list exact matches.

Additionally, we could have an interactive command to search for identifiers in the libraries attached to the project. That would require almost no new work then.

@andreasabel andreasabel added ux: error reporting Issues to do with how Agda reports errors ux: library management Issues relating to the library management system scope Issues relating to scope checking labels Aug 17, 2017
@asr asr added the type: enhancement Issues and pull requests about possible improvements label Aug 17, 2017
@WolframKahl
Copy link
Member

WolframKahl commented Aug 17, 2017 via email

@andreasabel
Copy link
Member Author

andreasabel commented Aug 18, 2017

@WolframKahl : good points!

We could cache a search index which is only rebuilt when a module of one of the used libraries changes. This would keep memory use pretty low, I suppose.

@andreasabel
Copy link
Member Author

We could even lazily build the search index only when it is used, i.e., by an error message or user query. For code that compiles in batch mode, this would be zero overhead then.

The search index can be built from the .agdai files, even out-dated ones. Basically from the last compilable state. This is important because we need it in cases where there are scope errors.

@WolframKahl
Copy link
Member

WolframKahl commented Aug 21, 2017 via email

@UlfNorell UlfNorell added this to the icebox milestone May 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope Issues relating to scope checking type: enhancement Issues and pull requests about possible improvements ux: error reporting Issues to do with how Agda reports errors ux: library management Issues relating to the library management system
Projects
None yet
Development

No branches or pull requests

4 participants