Skip to content

Support for Formatting #256

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

Merged
merged 70 commits into from
Nov 17, 2021
Merged

Support for Formatting #256

merged 70 commits into from
Nov 17, 2021

Conversation

gnikit
Copy link
Member

@gnikit gnikit commented Sep 21, 2021

Description

This PR adds support for formatting of both free-form and fixed-form Fortran and Fixes #29.
Two formatters have been added, findent and fprettify. findent is a performant, relatively mature formatter written in C++,
while fprettify is a newer formatter written in Python.

The ability to also install our dependencies has also been added, with the exception of fident that does not currently have a particularly user-friendly installer (depending on the OS you can install it through a PPA with sudo access but this is a massive security issue)

Due to us being able to use now findent a series of other features are also available like

  • conversion from/to fixed-form to/from free-form
  • relabelling of tags
  • dependency file generator (general and make)
  • refactoring of functions, subroutines, interfaces

Downloading the formatters

Both formatters can be installed through pip, e.g. pip install findent or pip install fprettify
For problems with the installation of fident through pip please go to: https://github.com/gnikit/findent-pypi

TODO

  • Add findent to be installed through pip
  • Add check for findent version 4.1.2+ to enable --align-paren=1 as an input argument.
  • Add safe checks for fprettify can only be used with F90+
  • Add .F file and .snap file, also edit the testing grammar in package.json

Other Changes

  • Removed paths.ts and replaced with which, there is no measurable performance difference for not caching the fortls path see 4bc2d04
  • Edited some the tools to take a logger
  • Renamed the fortran_fixed-form to FortranFixedForm
  • Made the extension to activate with fixed form fortran
  • Enabled linter for fixed form

The changes to the fixed form, language ID, activation and linting were made because with the way the extension was setup we could not spawn a formatter for fixed form fortran.

- The file structures have been updated to abide with the latest config syntax
- Updated build commands in package.json
- Deleted tasks.json.old
Regenerated npm and yarn .json files
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
Changes all fortls instances with global variable
and makes pip install user based with upgrade.
@gnikit gnikit force-pushed the feature/formatting branch from dfe2d4c to 7129299 Compare October 1, 2021 20:26
gnikit added 10 commits October 19, 2021 12:22
Fixes Rename fortran_fixed-form to FortranFixedForm #259
Fixes Extension does not activate for FixedForm #257
Fixes Linting does not work for fixed format files #258
1. Fixes conditional trigger for linting
2. Moves which as a dependency
3. Adds logging output for when parts of the extension are enabled
@gnikit gnikit force-pushed the feature/formatting branch from ffeda02 to 251fb79 Compare October 19, 2021 11:22
@gnikit gnikit changed the base branch from feature/general-improvements to master October 20, 2021 22:57
@gnikit
Copy link
Member Author

gnikit commented Nov 16, 2021

So all the changes for this one (vs-icons) and all the other deps that we have had are now in master so if @krvajal you are okay with this I will merge it to master after I sort out the previous releases.

@gnikit gnikit merged commit def5fd6 into master Nov 17, 2021
@gnikit gnikit deleted the feature/formatting branch November 17, 2021 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a FORTRAN formatter
1 participant