Skip to content

Commit 960ebd0

Browse files
pedro-ricardokrvajal
authored andcommitted
Minor release - version 2.1.1 (#130)
* Updated Snippets fortran90.json - added a few more snippets #104 - fixed PR #103 - a few adjustments * correction for issue124 * Change getIncludeParams to a string array. This is necessary to have correct number of arguments when spawning gfortran. * environment processing avoid error on build. * light modifications, trailing spaces and === * Update package and CHANGELOG * Required modifications from krvajal * Fix wrong `select case` decrease indentation. * Highlight Fixes (#129) * Fix F77 dimension declaration * Fix select type highlight * Fix else highlight with end-line operator `;` * Fix highlight of OpenMP with line continuation
1 parent 428297e commit 960ebd0

File tree

8 files changed

+100
-59
lines changed

8 files changed

+100
-59
lines changed

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10-
## [2.1.0] - 2019-xx-xx
10+
## [2.1.1] - 2019-xx-xx
11+
12+
### Changed
13+
14+
- Improve syntax highlight (#128, #127)
15+
- Improve Paths to linter (#124)
16+
- Improve environment processing (#126)
17+
18+
### Added
19+
20+
- New snippets (#104)
21+
22+
## [2.1.0] - 2019-03-26
1123

1224
### Changed
1325

language-configuration.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"flags": "i"
5656
},
5757
"decreaseIndentPattern": {
58-
"pattern": "^\\s*end\\s*(select|if|do|function|subroutine|module|program)\\b.*$|^\\s*else|case\\b.*$",
58+
"pattern": "^\\s*end\\s*(select|if|do|function|subroutine|module|program)\\b.*$|^\\s*(else|case)\\b.*$",
5959
"flags": "i"
6060
}
6161
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "linter-gfortran",
33
"displayName": "Modern Fortran",
44
"description": "Modern Fortran language support, including syntax highlighting and error detection.",
5-
"version": "2.1.0",
5+
"version": "2.1.1",
66
"publisher": "krvajalm",
77
"engines": {
88
"vscode": "^1.30.x"

snippets/fortran90.json

Lines changed: 66 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"prefix": "program",
44
"body": [
55
"program ${1:name}",
6-
"implicit none",
7-
"",
6+
"\timplicit none",
7+
"\t${0}",
88
"end program ${1:name}"
99
],
1010
"description": "Program Skeleton"
@@ -13,31 +13,31 @@
1313
"prefix": "module",
1414
"body": [
1515
"module ${1:name}",
16-
"implicit none",
17-
"${2}",
16+
"\timplicit none",
17+
"\t${2}",
1818
"contains",
19+
"\t${0}",
1920
"end module ${1:name}"
2021
],
2122
"description": "Create a new module"
2223
},
2324
"Do Loop": {
2425
"prefix": "do",
2526
"body": [
26-
"do ${1:index} = ${2:start},${3:end}",
27-
" !TODO_statement",
28-
" ${4}",
29-
"enddo"
27+
"do ${1:index} = ${2:start}, ${3:end}",
28+
"\t${0}",
29+
"end do"
3030
],
3131
"description": "Create a do loop"
3232
},
3333
"Function": {
3434
"prefix": "fun",
3535
"body": [
3636
"function ${1:func}(${2:arg}) result(${3:retval})",
37-
"${4:type} :: ${2:arg}",
38-
"${4:type} :: ${3:retval}",
39-
" !TODO_add_body",
40-
" ${5}",
37+
"\timplicit none",
38+
"\t${4:type} :: ${2:arg}",
39+
"\t${4:type} :: ${3:retval}",
40+
"\t${0}",
4141
"end function ${1:func}"
4242
],
4343
"description": "Create a function"
@@ -46,35 +46,66 @@
4646
"prefix": "sub",
4747
"body": [
4848
"subroutine ${1:routine}(${2:arg1}, ${3: arg2})",
49-
"${4:type1},intent(in) :: ${2:arg1}",
49+
"implicit none",
50+
"${4:type1},intent(in) :: ${2:arg1}",
5051
"${5:type2},intent(out) :: ${3:arg2}",
51-
" !TODO_add_body",
52-
" ${6}",
52+
"${0}",
5353
"end subroutine ${1:routine}"
5454
],
55-
"description": "Create a function"
55+
"description": "Create a subroutine"
56+
},
57+
"ifs": {
58+
"prefix": "if",
59+
"body": [
60+
"if ( ${1:condition} ) ${0}"
61+
],
62+
"description": "if (single line)"
63+
},
64+
"if": {
65+
"prefix": "if",
66+
"body": [
67+
"if ( ${1:condition} ) then",
68+
"\t${0}",
69+
"end if"
70+
],
71+
"description": "if then"
72+
},
73+
"elif": {
74+
"prefix": "el",
75+
"body": [
76+
"else if ( ${1:condition} ) then",
77+
"\t${0}"
78+
],
79+
"description": "else if"
80+
},
81+
"imp": {
82+
"prefix": "imp",
83+
"body": [
84+
"implicit none",
85+
"${0}"
86+
],
87+
"description": "implicit none"
5688
},
5789
"Module documentation header": {
58-
"prefix": "modoc" ,
59-
"body": [ "!------------------------------------------------------------------------------",
60-
"! ${1:Institution}, ${2:Affiliation}",
61-
"!------------------------------------------------------------------------------",
62-
"!",
63-
"! MODULE: ${3: Module name}",
64-
"!",
65-
"!> @author",
66-
"!> ${4:Author Name}}",
67-
"!",
68-
"! DESCRIPTION: ",
69-
"!> ${5: Short module description}",
70-
"!",
71-
"! REVISION HISTORY:",
72-
"! dd Mmm yyyy - Initial Version",
73-
"! TODO_dd_mmm_yyyy - TODO_describe_appropriate_changes - TODO_name",
74-
"!------------------------------------------------------------------------------"
90+
"prefix": "modoc",
91+
"body": [
92+
"!------------------------------------------------------------------------------",
93+
"! ${1:Institution}, ${2:Affiliation}",
94+
"!------------------------------------------------------------------------------",
95+
"!",
96+
"! MODULE: ${3: Module name}",
97+
"!",
98+
"!> @author",
99+
"!> ${4:Author Name}}",
100+
"!",
101+
"! DESCRIPTION: ",
102+
"!> ${5: Short module description}",
103+
"!",
104+
"! REVISION HISTORY:",
105+
"! dd Mmm yyyy - Initial Version",
106+
"! TODO_dd_mmm_yyyy - TODO_describe_appropriate_changes - TODO_name",
107+
"!------------------------------------------------------------------------------"
75108
],
76109
"description": "Add module documentation header"
77110
}
78-
79-
80111
}

src/features/linter-provider.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ export default class FortranLintingProvider {
3333
*
3434
* see also: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
3535
*/
36-
const env = {
37-
...process.env,
38-
LC_ALL: 'C'
39-
};
40-
if (process.platform == 'win32') {
36+
const env = process.env;
37+
env.LC_ALL = 'C';
38+
if (process.platform === 'win32') {
4139
// Windows needs to know the path of other tools
4240
if (!env.Path.includes(path.dirname(command))) {
4341
env.Path = `${path.dirname(command)}${path.delimiter}${env.Path}`;
@@ -107,7 +105,7 @@ export default class FortranLintingProvider {
107105
);
108106
let argList = [
109107
...args,
110-
getIncludeParams(includePaths), // include paths
108+
...getIncludeParams(includePaths), // include paths
111109
textDocument.fileName,
112110
`-o ${fileNameWithoutExtension}.mod`
113111
];

src/lib/helper.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@ export const _loadDocString = (keyword: string) => {
8787
};
8888

8989
export const getIncludeParams = (paths: string[]) => {
90-
if (paths.length === 0) {
91-
return '';
92-
}
93-
return '-I ' + paths.join(' ');
90+
return paths.map(path => `-I${path}`)
9491
};
9592

9693
export function isPositionInString(

syntaxes/fortran_free-form.tmLanguage.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@
12361236
"patterns": [
12371237
{
12381238
"comment": "rest of else line",
1239-
"begin": "(?!(\\s*!)|(\\s*\\n))",
1239+
"begin": "(?!(\\s*(;|!|\\n)))",
12401240
"end": "(?=[;!\\n])",
12411241
"patterns": [
12421242
{
@@ -1278,7 +1278,7 @@
12781278
"patterns": [
12791279
{
12801280
"name": "meta.block.select.fortran",
1281-
"begin": "(?i)\\b(select\\s*case|selectcase)\\b",
1281+
"begin": "(?i)\\b(select)",
12821282
"beginCaptures": {
12831283
"1": {
12841284
"name": "keyword.control.select.fortran"
@@ -1293,7 +1293,7 @@
12931293
"patterns": [
12941294
{
12951295
"comment": "Select case construct. Introduced in the Fortran 1990 standard.",
1296-
"begin": "(?i)^\\s*\\b(case)\\b",
1296+
"begin": "(?i)\\s*(case)\\b",
12971297
"beginCaptures": {
12981298
"1": {
12991299
"name": "keyword.control.case.fortran"
@@ -1336,10 +1336,10 @@
13361336
},
13371337
{
13381338
"comment": "Select type construct. Introduced in the Fortran 2003 standard.",
1339-
"begin": "(?i)\\G\\s*\\b(type)\\b",
1339+
"begin": "(?i)\\s*(type)\\b",
13401340
"beginCaptures": {
13411341
"1": {
1342-
"name": "keyword.control.case.fortran"
1342+
"name": "keyword.control.type.fortran"
13431343
}
13441344
},
13451345
"end": "(?i)(?=\\b(end\\s*select)\\b)",
@@ -1348,7 +1348,7 @@
13481348
"include": "#parentheses"
13491349
},
13501350
{
1351-
"begin": "(?i)\\b(?:(class)|(type))\\b",
1351+
"begin": "(?i)\\b(?:(class)|(type))",
13521352
"beginCaptures": {
13531353
"1": {
13541354
"name": "keyword.control.class.fortran"
@@ -1368,7 +1368,7 @@
13681368
}
13691369
},
13701370
{
1371-
"match": "(?i)\\G\\s*\\b(is)\\b",
1371+
"match": "(?i)\\G\\s*(is)\\b",
13721372
"captures": {
13731373
"1": {
13741374
"name": "keyword.control.is.fortran"
@@ -4064,7 +4064,7 @@
40644064
},
40654065
"type-specification-statements": {
40664066
"name": "meta.specification.type.fortran",
4067-
"begin": "(?ix)(?=\\b(?:character|class|complex|double\\s*precision|double\\s*complex|integer|logical|real|type)\\b(?![^'\";!\\n]*\\bfunction\\b))",
4067+
"begin": "(?ix)(?=\\b(?:character|class|complex|double\\s*precision|double\\s*complex|integer|logical|real|type|dimension)\\b(?![^'\";!\\n]*\\bfunction\\b))",
40684068
"end": "(?=[\\);!\\n])",
40694069
"patterns": [
40704070
{
@@ -4670,7 +4670,7 @@
46704670
]
46714671
},
46724672
{
4673-
"match": "(?ix)\\b(?:(complex)|(double\\s*precision)|(double\\s*complex)|(integer)|(real))\\b(?:\\s*(\\*)\\s*(\\d*))?",
4673+
"match": "(?ix)\\b(?:(complex)|(double\\s*precision)|(double\\s*complex)|(integer)|(real)|(dimension))\\b(?:\\s*(\\*)\\s*(\\d*))?",
46744674
"captures": {
46754675
"1": {
46764676
"name": "storage.type.complex.fortran"
@@ -4688,9 +4688,12 @@
46884688
"name": "storage.type.real.fortran"
46894689
},
46904690
"6": {
4691+
"name": "storage.type.dimension.fortran"
4692+
},
4693+
"7": {
46914694
"name": "keyword.operator.multiplication.fortran"
46924695
},
4693-
"7": {
4696+
"8": {
46944697
"name": "constant.numeric.fortran"
46954698
}
46964699
}

syntaxes/openmp_lang.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"name": "meta.openmp.directive",
99
"begin": "(?i)\\G(\\$(omp\\b)?&?)",
1010
"beginCaptures": { "1": { "name": "comment.directive.openmp" } },
11-
"end": "(?=[$\\n])",
11+
"end": "(?=[\\n])",
1212
"patterns": [
1313
{ "include": "#environment-variables" },
1414
{ "include": "#intrinsic-functions" },

0 commit comments

Comments
 (0)