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

Documentation on hover for intrinsic functions not working #250

Closed
maroony opened this issue Aug 6, 2021 · 8 comments · Fixed by #244
Closed

Documentation on hover for intrinsic functions not working #250

maroony opened this issue Aug 6, 2021 · 8 comments · Fixed by #244
Labels

Comments

@maroony
Copy link

maroony commented Aug 6, 2021

I do not use other fortran plugins and this feature doens't work for release 2.2.2 (= 2.3.0 Marketplace?).

Example (documentation for intrinsic function max doesn't show up):

module my

  implicit none

contains

  subroutine routine(arg)
    implicit none
    integer :: arg

    arg = max(arg, 0)

  end subroutine routine

end module my

@jefflarkin
Copy link

I'm seeing the same thing. In my local copy, if I copy src/docs to out/src/docs and rebuild, I start getting the pop-ups, so it may be a simple build issue. I will note though that the first time I hover over max I get an error in the debug console and I don't know the code well enough to know whether it's something I would have caused by making this copy. I do get the pop-up despite the error. The error comes from bootstrap-fork.js:5.

@gnikit
Copy link
Member

gnikit commented Sep 18, 2021

@maroony In general the vscode-fortran-support extension for a complete IDE-like experience is meant to be used with the fortran-language-server and the accompanying VSCode extension FORTRAN IntelliSense. The language server which is parsed into vscode through the FORTRAN IntelliSense extension provides substantially more features, liker complete hover support, go-tos and peek definitions and many more. For these reasons it is rarely recommended to use the inbuilt hover support since it is limited to Fortran intrinsics we have copied of the gfortran documentation. You can enable/disable the inbuilt hover support with "fortran.provideHover": true,

Now @jefflarkin I think you are onto something. Even though we rarely use the inbuilt hover it ought to still be functional. The offending line of code is https://github.com/krvajal/vscode-fortran-support/blob/0b6021126d4b2f72d258b7700b962d5f8a0afc95/src/lib/helper.ts#L42 where it looks for the docs inside out/src and it fails to find it so in the end does nothing.

There also appears to be a problem with parsing the .json documentation files into html.

@gnikit gnikit added the bug label Sep 18, 2021
@jefflarkin
Copy link

@gnikit Yes, this is where I tripped across my workaround. Seems like if the build process were slightly modified to copy those files into the out directory, then that file would cause the built-in hover to work.

I wasn't aware of the suggestion to install the other extensions either. Maybe the documentation could be improved to make that more obvious?

@maroony
Copy link
Author

maroony commented Sep 20, 2021

@gnikit Thanks for your feedback. So, maybe the whole feature could be removed in this extension? I'll give Fortran IntelliSense a try.

@gnikit
Copy link
Member

gnikit commented Sep 20, 2021

Yes, I will have a look into it. I have been a bit busy lately with PhD submission closing in and I will admit, it has been a while since I wrote any TypeScript.
I don't think we can simply call cp when building since it is not platform independent. I seem to recall a package called ncp that might be of use.

I wasn't aware of the suggestion

I realised that too. I will add a notify button or something + update README. There is an open PR where we are adding small bits and pieces such as this.

@gnikit
Copy link
Member

gnikit commented Sep 20, 2021

So the feature still works (without the bug jeff mentioned) but with very limited support, compared to what a full language server can provide. I would be reluctant to remove it because then we would have no hover functionality, and since we are not the only Fortran extension out there we can't simply "copy" the Fortran IntelliSense code.

@gnikit
Copy link
Member

gnikit commented Sep 20, 2021

A bit more on my initial comment about needing Fortran IntelliSense for integration with the Language Server.

That is not entirely true. A while ago we were able to interface with fortls directly, the user would have to pass the options to fortls either through languageServerFlags or with a .fortls file.

From what I recall, around 2 years ago (see #121) the 2 extensions became incompatible with one another so the decision was made to disable vscode-fortran-support's interface with fortls and leave it completely up to Fortran IntelliSense who was created by the author of fortls.

Our interface still works, you can test it yourself by setting the if conditional to true in https://github.com/krvajal/vscode-fortran-support/blob/0b6021126d4b2f72d258b7700b962d5f8a0afc95/src/extension.ts#L56 and supplying a .fortls in the root of your Extension Development Host like this one

{
  "variable_hover": true,
  "hover_signature": true,
  "lowercase_intrinsics": true,
  "use_signature_help": true,
  "enable_code_actions": true
}

Given that the Fortran IntelliSense Extension has not been updated for quite some time, it might be worth reintroducing our own fortls interface.

gnikit added a commit that referenced this issue Oct 1, 2021
@gnikit gnikit mentioned this issue Oct 1, 2021
19 tasks
@gnikit
Copy link
Member

gnikit commented Oct 2, 2021

This is now fixed in PR #244 and will be included in the next release.

@gnikit gnikit closed this as completed Oct 2, 2021
krvajal pushed a commit that referenced this issue Oct 20, 2021
* Updated CHANGELOG for v2.2.2

* Incremented package version to 2.2.2

* Minor aesthetic improvements to CHANGELOG

* Adds OpenACC unit test

* Updated tasks and launch files

- The file structures have been updated to abide with the latest config syntax
- Updated build commands in package.json
- Deleted tasks.json.old

* Fixes Remove unused packages #243

Regenerated npm and yarn .json files

* Updated README badges

* Updated workflows to run on Ubuntu latest

* Fix overzealous OpenMP regex.

The OpenMP regex did not allow for the OpenACC syntax scope to trigger.
This has now been fixed and both should be displayed correctly.

The only outstanding problem is that the unittest (.snap) does not
trigger the right scopes, which means open acc/openmp are not
tested thoroughly. I look into it

* Updating changelog.md

* New minor release

* Housekeeping

Changes all fortls instances with global variable
and makes pip install user based with upgrade.

* Added info to package.json

* Fixes in-house documentaiton hover

Fixes #250

* Now the deocumentation displays correctly

Having preceding characters to ``` caused a problem in the hover result

* Formatting .json doc files with prettier

* Updated README.md

* Adds VS marketplace automated release

Fixes Setting up VSCE releases from GitHub releases #237

* Further improvements to the hover documentation

* further fixes for internal documentation

* Adds autoclosing for strings

* Updates Fortran extensino and adds .pFUnit support

Fixes #185.

* Updates CHANGELOG.md

* Fixes preprocessor syntax highlighting

The line continuation operator is a bit too aggressive so instead of
adding lookaheads for every case where we don't need to apply it
we have excluded the preprocessor directives from the lint cont.

The original .cson highlighting does the same, see:
https://github.com/dparkins/language-fortran/blob/master/grammars/fortran%20-%20free%20form.cson

for injections see:
https://gist.github.com/Aerijo/b8c82d647db783187804e86fa0a604a1

Fixes Preprocessor statements in line continuations break syntax highlighting #248
Fixes Erroneous syntax highlighting for preprocessor conditionals in derived types #249

* Preprocessor assignment i.e. = is not a thing

The regex was doing a negative look ahead and lookbehind for =
but using = is illegal code and will not compile. e.g. #define VAR = 1

Also I went ahead and changed the patterns #define can match to be
both string literals and numerical values #define VAR 1 is legal.

* Preprocessor operator fixes

- Adds support for all Fortran supported logical preprocessor operators
- Adds support for arithmetic operators
- Adds support for C++ preprocessor integers
- Changes the syntax highlighting of preprocessor commands to use the
   `meta` scope which should result in consistent coloring between
   C++ and Fortran. A few things are not supported like macro function
   argument highlighting but I do not believe it is important for now

* Fixes Erroneous syntax highlighting, when argument is called "function" or "procedure" #207

I have used non-fixed width ngative lookbehinds which should not
 be permitted in traditional Oniguruma regex. VSCode's implementation of
 the regex engine does not seem to care hence the solution

* Adds unittest for #207 and updates CHANGELOG

* Adds syntax highlighting support for fypp
also extends the support for pfunit.

Not sure if .pf and .fpp are considered to be fixed-form by default
I don't think that is the case but fypp and pfunit use them so we
default them to free-form

* Add MIT license badge back to README

* Adds names specific to individual scopes

This is meant to make debugging syntax highlighting bugs easier to trace

The unittests are also updated to contain the new scope names.

* Fixes Erroneous syntax highlighting of if construct with tags #204

Labels were only captured at the start and end of a statement.
Now we are also capturing them in between for if conditionals.

 The edits in the end in "named-control-constructs" are meant to
 correctly handle whitespaces which before they were placed as part of
 the group returned to the invalid.error.xxx

 A unittest has been added testing the conditionals with/out labels.

* Updated CHANGELOG.md

* Fixes STOP named_string #172

`stop` can now handle labels

* Comments are correctly highlighted for type,...

Fixes Erroneous syntax highlighting with type,abstract :: var #262
A unittest has been added and the CHANGELOG has been updated.

* Add syntax test for fixed form fortran

* Switches to @types/vscode & @vscode/test-electron

Also updates the tests to use strictEqual
Adds production, test and dev tscofig compilation

Fixes Migrate from vscode module #263

* Updated changelog

* Updated yarn.lock

* Increments version to 2.4.0

Release a tag after token is uploaded

* Updated tasks.json and launch.json

External extensions are enabled since we need the C++ extension
for VSCode to launch without throwing an error.
The tasks.json has been updated to call directly scripts from package.

* Updated names of scopes to contain fortran

* Fixes normal labeled construct end statements

* Adds error highlighting for else labeled

* Upgraded package.json grammar update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants