Skip to content

Commit d2c7dd5

Browse files
committed
Added ifx linting support
Removed `flang` references from README and package.json since `flang` is difficult to isntall for new VS code users. Will add flang if there is a request.
1 parent 2efbe03 commit d2c7dd5

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111

1212
### Added
1313

14+
- Added `ifx` support Intel's LLVM based compiler `ifx`
1415
- Added ability to rescan for linting include files.
1516
- Added GitHub Actions support for pre-Release builds
1617
([#459](https://github.com/fortran-lang/vscode-fortran-support/issues/459))

CONTRIBUTING.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,4 @@ You can actively debug the extension by pressing <kbd>F5</kbd> with `Launch Exte
5959
👉 **Tip!** You don't need to stop and restart the development version of VS Code after each change. You can just execute `Reload Window` from the command palette in the
6060
VS Code window prefixed with `[Extension Development Host]`.
6161

62-
63-
6462
https://user-images.githubusercontent.com/16143716/167411072-58a25378-13ad-41c5-bb20-2dacc8ad004a.mp4
65-
66-
67-

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- GoTo/Peek implementation and Find/Peek references
2424
- Project-wide and Document symbol detection and Renaming
2525
- Native Language Server integration with [`fortls`](https://github.com/gnikit/fortls)
26-
- Linting support for `gfortran`, `flang` and `ifort`
26+
- Linting support for GCC's [`gfortran`](https://gcc.gnu.org/wiki/GFortran), and Intel's [`ifort`](https://www.intel.com/content/www/us/en/developer/tools/oneapi/fortran-compiler.html) and `ifx`
2727
- Debugger [C/C++ extension](https://github.com/Microsoft/vscode-cpptools)
2828
- Formatting with [findent](https://github.com/gnikit/findent-pypi) or [fprettify](https://github.com/pseewald/fprettify)
2929
- Code snippets (more can be defined by the user [see](https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets))
@@ -60,7 +60,7 @@ Using incorrect type and rank as function argument
6060

6161
![alt](assets/lint-demo2.gif)
6262

63-
| :memo: Note |
63+
| 📝️ Note |
6464
| ------------------------------------------ |
6565
| Save your file to generate linting results |
6666

@@ -70,7 +70,7 @@ Linting results can be improved by providing additional options to the compiler.
7070

7171
You can control the include paths to be used by the linter with the `fortran.linter.includePaths` option.
7272

73-
| :exclamation: Important |
73+
| ❗️ Important |
7474
| ------------------------------------------------------------------------------------------------------------------ |
7575
| For the best linting results `linter.includePaths` should match the included paths for your project's compilation. |
7676

@@ -80,7 +80,7 @@ You can control the include paths to be used by the linter with the `fortran.lin
8080
}
8181
```
8282

83-
| :exclamation: Important |
83+
| ❗️ Important |
8484
| -------------------------------------------------------------------------------- |
8585
| If a glob pattern is used only directories matching the pattern will be included |
8686

@@ -103,12 +103,12 @@ Default value is `-Wall` (or `-warn all` for ifort).
103103

104104
### Changing linting compiler
105105

106-
By default, the linter used is `gfortran`, Intel's `ifort` and LLVM's `flang` are also supported.
106+
By default, the linter used is `gfortran`, Intel's `ifort` and Intel's LLVM based compiler `ifx` are also supported.
107107
One can use a different linter compiler via the option
108108

109109
```jsonc
110110
{
111-
"fortran.linter.compiler": "ifort" | "gfortran" | "flang" | "Disabled"
111+
"fortran.linter.compiler": "ifort" | "gfortran" | "ifx" | "Disabled"
112112
}
113113
```
114114

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@
166166
"default": "gfortran",
167167
"enum": [
168168
"gfortran",
169-
"flang",
170169
"ifort",
170+
"ifx",
171171
"Disabled"
172172
],
173173
"markdownDescription": "Compiler used for linting support."
@@ -275,7 +275,7 @@
275275
"fortran.fortls.maxLineLength": {
276276
"type": "number",
277277
"default": -1,
278-
"markdownDescription": "Maximum line length. For `gfortran` and `flang` this also sets the linting compiler flag `-ffree-line-length-<n>` and `-ffixed-line-length-<n>`. Default value is `none`."
278+
"markdownDescription": "Maximum line length. For `gfortran` this also sets the linting compiler flag `-ffree-line-length-<n>` and `-ffixed-line-length-<n>`. Default value is `none`."
279279
},
280280
"fortran.fortls.maxCommentLineLength": {
281281
"type": "number",

src/features/linter-provider.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ export class FortranLintingProvider {
142142
let modout: string = config.get('linter.modOutput', '');
143143
let modFlag = '-J';
144144
switch (compiler) {
145+
case 'ifx':
145146
case 'ifort':
146147
modFlag = '-module ';
147148
break;
@@ -240,7 +241,7 @@ export class FortranLintingProvider {
240241
* specified.
241242
* Attempts to match and resolve any internal variables, but no glob support.
242243
*
243-
* @param compiler compiler name `gfortran`, `flang`, `ifort`
244+
* @param compiler compiler name `gfortran`, `ifort`, `ifx`
244245
* @returns
245246
*/
246247
private getLinterExtraArgs(compiler: string): string[] {
@@ -255,6 +256,7 @@ export class FortranLintingProvider {
255256
args = ['-Wall'];
256257
break;
257258

259+
case 'ifx':
258260
case 'ifort':
259261
args = ['-warn', 'all'];
260262
break;
@@ -269,7 +271,7 @@ export class FortranLintingProvider {
269271
// gfortran and flang have compiler flags for restricting the width of
270272
// the code.
271273
// You can always override by passing in the correct args as extraArgs
272-
if (compiler !== 'ifort') {
274+
if (compiler !== 'ifort' && compiler !== 'ifx') {
273275
const ln: number = config.get('fortls.maxLineLength');
274276
const lnStr: string = ln === -1 ? 'none' : ln.toString();
275277
args.push(`-ffree-line-length-${lnStr}`, `-ffixed-line-length-${lnStr}`);
@@ -339,6 +341,7 @@ export class FortranLintingProvider {
339341
case 'flang':
340342
break;
341343

344+
case 'ifx':
342345
case 'ifort':
343346
for (const m of matches) {
344347
const g = m.groups;
@@ -420,6 +423,7 @@ export class FortranLintingProvider {
420423
failing line of code
421424
----------------------^
422425
*/
426+
case 'ifx':
423427
case 'ifort':
424428
// see https://regex101.com/r/GZ0Lzz/2
425429
return /^(?<fname>(?:\w:\\)?.*)\((?<ln>\d+)\):\s*(?:#(?:(?<sev2>\w*):\s*(?<msg2>.*$))|(?<sev1>\w*)\s*(?<msg1>.*$)(?:\s*.*\s*)(?<cn>-*\^))/gm;
@@ -447,6 +451,7 @@ export class FortranLintingProvider {
447451

448452
// ifort theoretically supports fsyntax-only too but I had trouble
449453
// getting it to work on my machine
454+
case 'ifx':
450455
case 'ifort':
451456
return ['-syntax-only', '-fpp'];
452457

0 commit comments

Comments
 (0)