fwcd / curry-language-server

IDE support for the functional logic language Curry
BSD 3-Clause "New" or "Revised" License
27 stars 2 forks source link

Always prefer source locations over interface files during definition lookup #26

Closed fwcd closed 5 months ago

fwcd commented 3 years ago

Find symbols in the project's source file, even if the compiler refers to a definition from an ICurry file.

fwcd commented 1 year ago

The issue seems to be that the interface (.icurry) files seem to take precedence in the frontend if they already exist, otherwise the source file locations (e.g. <path to pakcs>/lib/Prelude.curry) are indexed as intended. This is where the indexing happens on the language server side:

https://github.com/fwcd/curry-language-server/blob/1462877991d3a414fe816e80aa264c82195e7a8a/src/Curry/LanguageServer/Index/Store.hs#L297-L307

Since the symbols are only indexed once, the language server will keep the correct source path for until it is restarted, if the .icurry didn't exist at startup. Thus we would have to update the frontend to always 'prefer' the source file's location.

fwcd commented 9 months ago

A potential solution here would be to attach source information via #line directives in the .icurry files, similar to those emitted by the C preprocessor. The frontend should also know how to parse these directives and include them in the abstract representation, for use by the language server.