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

Feature/hover-functions #49

Merged
merged 11 commits into from
Feb 22, 2022
Merged

Feature/hover-functions #49

merged 11 commits into from
Feb 22, 2022

Conversation

gnikit
Copy link
Member

@gnikit gnikit commented Feb 21, 2022

Fixes a series of hovering bugs for functions.

Closes Type prefixed functions display wrong signature upon hover #22
Functions now all display the same signature:
`type` `keywords` `function` `name(args)` `result(val)`

- Submodule module procedure functions now display like so
- functions without an explicit type or result now display like so
- Nested functions i.e. using functions as args displays like so

Closes Add support for Fortran scope/block snippets #47

Adds a series of hover unittests.
Also renamed the result variables
@codecov
Copy link

codecov bot commented Feb 21, 2022

Codecov Report

Merging #49 (8aa6478) into master (b0987da) will increase coverage by 0.33%.
The diff coverage is 82.65%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #49      +/-   ##
==========================================
+ Coverage   81.01%   81.34%   +0.33%     
==========================================
  Files           9        9              
  Lines        4288     4305      +17     
==========================================
+ Hits         3474     3502      +28     
+ Misses        814      803      -11     
Impacted Files Coverage Δ
fortls/intrinsics.py 91.85% <ø> (ø)
fortls/langserver.py 71.88% <50.00%> (+0.02%) ⬆️
fortls/objects.py 81.38% <90.62%> (+0.67%) ⬆️
fortls/parse_fortran.py 86.35% <91.30%> (+0.03%) ⬆️
fortls/constants.py 100.00% <100.00%> (ø)
fortls/helper_functions.py 86.89% <100.00%> (+0.48%) ⬆️
fortls/regex_patterns.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b0987da...8aa6478. Read the comment docs.

It required major rewrite of the function definition parsing

Closes Functions with multiple keywords display incorrect hover #48

TODO:
1. Add tests about intrinsic functions
2. Add tests about functions returning arrays (this is actually a big deal)

2. touches on if hover should be displaying FORTRAN abiding code.
I am leaning towards yes, so displaying
```fortran
real dimension(10,10) function foo(arg) result(val)
  real, intent(in) :: arg
```
Does not seem the right thing for me to do. I think the hover request
should return instead
```fortran
real function foo(arg) result(val)
  real, intent(in) :: arg
  real, dimension(10,10) :: val
```

This way syntax highlighting in VSCode will not complain
Edit regex and replace to consider word boundaries
- Makes hover more robust
- Adds extensive unittests for hover support of functions
- Improves documentation of function hover
functions that do not use the word `result` but do define a variable
that is the same as the function name previously failed to get refs

A unittest has been added for this case
@gnikit gnikit merged commit 914ff47 into master Feb 22, 2022
@gnikit gnikit deleted the feature/hover-functions branch February 22, 2022 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant