Skip to content

Commit 1dd14e9

Browse files
authored
Merge pull request #445 from fortran-lang/gnikit/issue309
Slow performance syntax highlighting
2 parents 6489930 + 76c3ef6 commit 1dd14e9

6 files changed

+1145
-353
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111

1212
### Fixed
1313

14+
- Fixed slow performance of very long lines by using a different solution for
15+
([#207](https://github.com/fortran-lang/vscode-fortran-support/issues/207))
16+
([#309](https://github.com/fortran-lang/vscode-fortran-support/issues/309))
1417
- Fixed hovering over user defined types while debugging
1518
([#426](https://github.com/fortran-lang/vscode-fortran-support/issues/426))
1619
- Fixes linting regex to capture a wider spectrum of errors

syntaxes/fortran_free-form.tmLanguage.json

+7-8
Original file line numberDiff line numberDiff line change
@@ -2543,7 +2543,7 @@
25432543
"derived-type-component-type-specification": {
25442544
"comment": "Introduced in the Fortran 1995 standard.",
25452545
"name": "meta.specification.derived-type.fortran",
2546-
"begin": "(?ix)(?=\\b(?:character|class|complex|double\\s*precision|double\\s*complex|integer|logical|real|type)\\b(?![^'\";!\\n]*(?<!\\(\\s*|::\\s*)\\bfunction\\b))",
2546+
"begin": "(?ix)(?=\\b(?:character|class|complex|double\\s*precision|double\\s*complex|integer|logical|real|type)\\b(?![^:'\";!\\n]*\\bfunction\\b))",
25472547
"end": "(?=[;!\\n])",
25482548
"patterns": [
25492549
{
@@ -4010,8 +4010,7 @@
40104010
"function-definition": {
40114011
"comment": "Function program unit. Introduced in the Fortran 1977 standard.",
40124012
"name": "meta.function.fortran",
4013-
"comment2": "Escape :: ( , if they are before function. These are non-fixed width lookbehinds but they seem to work",
4014-
"begin": "(?i)(?=([^'\";!\\n](?!\\bend))*(?:(?<!\\(\\s*|::\\s*|,\\s*))\\bfunction\\b)",
4013+
"begin": "(?i)(?=([^:'\";!\\n](?!\\bend)(?!\\bsubroutine\\b))*\\bfunction\\b)",
40154014
"end": "(?=[;!\\n])",
40164015
"patterns": [
40174016
{
@@ -4094,8 +4093,8 @@
40944093
{
40954094
"comment": "Specification and execution block.",
40964095
"name": "meta.block.specification.function.fortran",
4097-
"begin": "(?i)(?!(?:end\\s*[;!\\n]|end\\s*function\\b))",
4098-
"end": "(?i)(?=(?:end\\s*[;!\\n]|end\\s*function\\b))",
4096+
"begin": "(?i)(?!\\b(?:end\\s*[;!\\n]|end\\s*function\\b))",
4097+
"end": "(?i)(?=\\b(?:end\\s*[;!\\n]|end\\s*function\\b))",
40994098
"patterns": [
41004099
{
41014100
"comment": "Contains block.",
@@ -4106,7 +4105,7 @@
41064105
"name": "keyword.control.contains.fortran"
41074106
}
41084107
},
4109-
"end": "(?i)(?=\\s*(?:end\\s*[;!\\n]|end\\s*function\\b))",
4108+
"end": "(?i)(?=(?:end\\s*[;!\\n]|end\\s*function\\b))",
41104109
"patterns": [
41114110
{
41124111
"include": "$base"
@@ -4350,7 +4349,7 @@
43504349
"subroutine-definition": {
43514350
"comment": "Subroutine program unit. Introduced in the Fortran 1977 standard.",
43524351
"name": "meta.subroutine.fortran",
4353-
"begin": "(?i)(?=([^'\";!\\n](?!\\bend))*(?:(?<!::\\s*))\\bsubroutine\\b)",
4352+
"begin": "(?i)(?=([^:'\";!\\n](?!\\bend))*\\bsubroutine\\b)",
43544353
"end": "(?=[;!\\n])",
43554354
"patterns": [
43564355
{
@@ -4542,7 +4541,7 @@
45424541
"type-specification-statements": {
45434542
"name": "meta.specification.type.fortran",
45444543
"comment": "Supported types for function and escape :: if function is used as a variable name (which is bad practice).",
4545-
"begin": "(?ix)(?=\\b(?:character|class|complex|double\\s*precision|double\\s*complex|integer|logical|real|type|dimension)\\b(?![^'\";!\\n]*(?<!\\(\\s*|::\\s*)\\bfunction\\b))",
4544+
"begin": "(?ix)(?=\\b(?:character|class|complex|double\\s*precision|double\\s*complex|integer|logical|real|type|dimension)\\b(?![^'\";!\\n:]*\\bfunction\\b))",
45464545
"end": "(?=[\\);!\\n])",
45474546
"patterns": [
45484547
{

test/resources/function_subroutine_definitions.f90

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
interface function_subroutine_definitions
21

32
! Normal subroutine
43
subroutine sub( arg )
@@ -46,5 +45,3 @@ end subroutine sub_with_sub
4645
subroutine sub_with_fun( function )
4746
integer, intent(inout) :: function
4847
end subroutine sub_with_fun
49-
50-
end interface function_subroutine_definitions

0 commit comments

Comments
 (0)