Skip to content

Minor release - version 2.1.1 #130

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 15 commits into from
Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [2.1.0] - 2019-xx-xx
## [2.1.1] - 2019-xx-xx

### Changed

- Improve syntax highlight (#128, #127)
- Improve Paths to linter (#124)
- Improve environment processing (#126)

### Added

- New snippets (#104)

## [2.1.0] - 2019-03-26

### Changed

Expand Down
2 changes: 1 addition & 1 deletion language-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"flags": "i"
},
"decreaseIndentPattern": {
"pattern": "^\\s*end\\s*(select|if|do|function|subroutine|module|program)\\b.*$|^\\s*else|case\\b.*$",
"pattern": "^\\s*end\\s*(select|if|do|function|subroutine|module|program)\\b.*$|^\\s*(else|case)\\b.*$",
"flags": "i"
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "linter-gfortran",
"displayName": "Modern Fortran",
"description": "Modern Fortran language support, including syntax highlighting and error detection.",
"version": "2.1.0",
"version": "2.1.1",
"publisher": "krvajalm",
"engines": {
"vscode": "^1.30.x"
Expand Down
101 changes: 66 additions & 35 deletions snippets/fortran90.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"prefix": "program",
"body": [
"program ${1:name}",
"implicit none",
"",
"\timplicit none",
"\t${0}",
"end program ${1:name}"
],
"description": "Program Skeleton"
Expand All @@ -13,31 +13,31 @@
"prefix": "module",
"body": [
"module ${1:name}",
"implicit none",
"${2}",
"\timplicit none",
"\t${2}",
"contains",
"\t${0}",
"end module ${1:name}"
],
"description": "Create a new module"
},
"Do Loop": {
"prefix": "do",
"body": [
"do ${1:index} = ${2:start},${3:end}",
" !TODO_statement",
" ${4}",
"enddo"
"do ${1:index} = ${2:start}, ${3:end}",
"\t${0}",
"end do"
],
"description": "Create a do loop"
},
"Function": {
"prefix": "fun",
"body": [
"function ${1:func}(${2:arg}) result(${3:retval})",
"${4:type} :: ${2:arg}",
"${4:type} :: ${3:retval}",
" !TODO_add_body",
" ${5}",
"\timplicit none",
"\t${4:type} :: ${2:arg}",
"\t${4:type} :: ${3:retval}",
"\t${0}",
"end function ${1:func}"
],
"description": "Create a function"
Expand All @@ -46,35 +46,66 @@
"prefix": "sub",
"body": [
"subroutine ${1:routine}(${2:arg1}, ${3: arg2})",
"${4:type1},intent(in) :: ${2:arg1}",
"implicit none",
"${4:type1},intent(in) :: ${2:arg1}",
"${5:type2},intent(out) :: ${3:arg2}",
" !TODO_add_body",
" ${6}",
"${0}",
"end subroutine ${1:routine}"
],
"description": "Create a function"
"description": "Create a subroutine"
},
"ifs": {
"prefix": "if",
"body": [
"if ( ${1:condition} ) ${0}"
],
"description": "if (single line)"
},
"if": {
"prefix": "if",
"body": [
"if ( ${1:condition} ) then",
"\t${0}",
"end if"
],
"description": "if then"
},
"elif": {
"prefix": "el",
"body": [
"else if ( ${1:condition} ) then",
"\t${0}"
],
"description": "else if"
},
"imp": {
"prefix": "imp",
"body": [
"implicit none",
"${0}"
],
"description": "implicit none"
},
"Module documentation header": {
"prefix": "modoc" ,
"body": [ "!------------------------------------------------------------------------------",
"! ${1:Institution}, ${2:Affiliation}",
"!------------------------------------------------------------------------------",
"!",
"! MODULE: ${3: Module name}",
"!",
"!> @author",
"!> ${4:Author Name}}",
"!",
"! DESCRIPTION: ",
"!> ${5: Short module description}",
"!",
"! REVISION HISTORY:",
"! dd Mmm yyyy - Initial Version",
"! TODO_dd_mmm_yyyy - TODO_describe_appropriate_changes - TODO_name",
"!------------------------------------------------------------------------------"
"prefix": "modoc",
"body": [
"!------------------------------------------------------------------------------",
"! ${1:Institution}, ${2:Affiliation}",
"!------------------------------------------------------------------------------",
"!",
"! MODULE: ${3: Module name}",
"!",
"!> @author",
"!> ${4:Author Name}}",
"!",
"! DESCRIPTION: ",
"!> ${5: Short module description}",
"!",
"! REVISION HISTORY:",
"! dd Mmm yyyy - Initial Version",
"! TODO_dd_mmm_yyyy - TODO_describe_appropriate_changes - TODO_name",
"!------------------------------------------------------------------------------"
],
"description": "Add module documentation header"
}


}
10 changes: 4 additions & 6 deletions src/features/linter-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ export default class FortranLintingProvider {
*
* see also: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
*/
const env = {
...process.env,
LC_ALL: 'C'
};
if (process.platform == 'win32') {
const env = process.env;
env.LC_ALL = 'C';
if (process.platform === 'win32') {
// Windows needs to know the path of other tools
if (!env.Path.includes(path.dirname(command))) {
env.Path = `${path.dirname(command)}${path.delimiter}${env.Path}`;
Expand Down Expand Up @@ -107,7 +105,7 @@ export default class FortranLintingProvider {
);
let argList = [
...args,
getIncludeParams(includePaths), // include paths
...getIncludeParams(includePaths), // include paths
textDocument.fileName,
`-o ${fileNameWithoutExtension}.mod`
];
Expand Down
5 changes: 1 addition & 4 deletions src/lib/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ export const _loadDocString = (keyword: string) => {
};

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

export function isPositionInString(
Expand Down
23 changes: 13 additions & 10 deletions syntaxes/fortran_free-form.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@
"patterns": [
{
"comment": "rest of else line",
"begin": "(?!(\\s*!)|(\\s*\\n))",
"begin": "(?!(\\s*(;|!|\\n)))",
"end": "(?=[;!\\n])",
"patterns": [
{
Expand Down Expand Up @@ -1278,7 +1278,7 @@
"patterns": [
{
"name": "meta.block.select.fortran",
"begin": "(?i)\\b(select\\s*case|selectcase)\\b",
"begin": "(?i)\\b(select)",
"beginCaptures": {
"1": {
"name": "keyword.control.select.fortran"
Expand All @@ -1293,7 +1293,7 @@
"patterns": [
{
"comment": "Select case construct. Introduced in the Fortran 1990 standard.",
"begin": "(?i)^\\s*\\b(case)\\b",
"begin": "(?i)\\s*(case)\\b",
"beginCaptures": {
"1": {
"name": "keyword.control.case.fortran"
Expand Down Expand Up @@ -1336,10 +1336,10 @@
},
{
"comment": "Select type construct. Introduced in the Fortran 2003 standard.",
"begin": "(?i)\\G\\s*\\b(type)\\b",
"begin": "(?i)\\s*(type)\\b",
"beginCaptures": {
"1": {
"name": "keyword.control.case.fortran"
"name": "keyword.control.type.fortran"
}
},
"end": "(?i)(?=\\b(end\\s*select)\\b)",
Expand All @@ -1348,7 +1348,7 @@
"include": "#parentheses"
},
{
"begin": "(?i)\\b(?:(class)|(type))\\b",
"begin": "(?i)\\b(?:(class)|(type))",
"beginCaptures": {
"1": {
"name": "keyword.control.class.fortran"
Expand All @@ -1368,7 +1368,7 @@
}
},
{
"match": "(?i)\\G\\s*\\b(is)\\b",
"match": "(?i)\\G\\s*(is)\\b",
"captures": {
"1": {
"name": "keyword.control.is.fortran"
Expand Down Expand Up @@ -4064,7 +4064,7 @@
},
"type-specification-statements": {
"name": "meta.specification.type.fortran",
"begin": "(?ix)(?=\\b(?:character|class|complex|double\\s*precision|double\\s*complex|integer|logical|real|type)\\b(?![^'\";!\\n]*\\bfunction\\b))",
"begin": "(?ix)(?=\\b(?:character|class|complex|double\\s*precision|double\\s*complex|integer|logical|real|type|dimension)\\b(?![^'\";!\\n]*\\bfunction\\b))",
"end": "(?=[\\);!\\n])",
"patterns": [
{
Expand Down Expand Up @@ -4670,7 +4670,7 @@
]
},
{
"match": "(?ix)\\b(?:(complex)|(double\\s*precision)|(double\\s*complex)|(integer)|(real))\\b(?:\\s*(\\*)\\s*(\\d*))?",
"match": "(?ix)\\b(?:(complex)|(double\\s*precision)|(double\\s*complex)|(integer)|(real)|(dimension))\\b(?:\\s*(\\*)\\s*(\\d*))?",
"captures": {
"1": {
"name": "storage.type.complex.fortran"
Expand All @@ -4688,9 +4688,12 @@
"name": "storage.type.real.fortran"
},
"6": {
"name": "storage.type.dimension.fortran"
},
"7": {
"name": "keyword.operator.multiplication.fortran"
},
"7": {
"8": {
"name": "constant.numeric.fortran"
}
}
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/openmp_lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "meta.openmp.directive",
"begin": "(?i)\\G(\\$(omp\\b)?&?)",
"beginCaptures": { "1": { "name": "comment.directive.openmp" } },
"end": "(?=[$\\n])",
"end": "(?=[\\n])",
"patterns": [
{ "include": "#environment-variables" },
{ "include": "#intrinsic-functions" },
Expand Down