Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Search implementations in files with implicit requires #78

Merged
merged 3 commits into from
Apr 9, 2018

Conversation

faustinoaq
Copy link
Member

@faustinoaq faustinoaq commented Apr 9, 2018

NOTE: This feature doesn't affect scry performance, just increase the scope available to search methods and dependencies without requiring files explicitly (common practice in crystal projects)

Fixes #29

  • Use root_uri from workspace
  • Add get_scope to set scope to src folder on standard crystal projects
  • Also get_scope sets the scope to the worspace if no src folder exists
  • Send empty implementation message if an error is found...
  • ...enabling the message "not found implementation" in the LSP client

The rules are:

  1. If your project has a src directory (common on crystal projects) then you should have a main file that requires all others using require "./**/*" or similar
  2. If your project doesn't have a src folder then all the workspace is analyzed in aims to search symbols and methods, excluding spec and lib directories from primary scope (methods inside lib dir can be found if a primary scope file requires it)

The current spec already cover part of this feature, a full spec for this is a bit complicated because it requires a full workspace to test implicit requires

This PR also include a replacement and enhancement to the fix implemented on #63

vokoscreen-2018-04-09_02-50-12 1

* Use root_uri from workspace
* Add get_scope to set scope to src folder on standard crystal projects
* Also get_scope sets the scope to the worspace if no src folder exists
* Send empty implementation message if an error is found...
* ...enabling the message "not found implementation" in the LSP client
@faustinoaq faustinoaq requested a review from a team April 9, 2018 08:41
@faustinoaq
Copy link
Member Author

BTW, I tested this feature with an amber project and worked out-the-box

vokoscreen-2018-04-09_03-44-21

^ Notice I don't have any require at beginning of most of these files
^ Also notice the errors, now the diagnostic system is independent of search implementation, although, if the implementation tool finds a "valid" error (syntax, truly missing symbols, etc), then it will return "Implementation not found"

@faustinoaq faustinoaq merged commit e0a5698 into master Apr 9, 2018
@faustinoaq faustinoaq deleted the fa/implicit-requires-implementations branch April 9, 2018 18:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support mainFile setting
3 participants