Skip to content

Slow performance syntax highlighting #445

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 2 commits into from
Apr 27, 2022
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- Fixed slow performance of very long lines by using a different solution for
([#207](https://github.com/fortran-lang/vscode-fortran-support/issues/207))
([#309](https://github.com/fortran-lang/vscode-fortran-support/issues/309))
- Fixed hovering over user defined types while debugging
([#426](https://github.com/fortran-lang/vscode-fortran-support/issues/426))
- Fixes linting regex to capture a wider spectrum of errors
Expand Down
15 changes: 7 additions & 8 deletions syntaxes/fortran_free-form.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,7 @@
"derived-type-component-type-specification": {
"comment": "Introduced in the Fortran 1995 standard.",
"name": "meta.specification.derived-type.fortran",
"begin": "(?ix)(?=\\b(?:character|class|complex|double\\s*precision|double\\s*complex|integer|logical|real|type)\\b(?![^'\";!\\n]*(?<!\\(\\s*|::\\s*)\\bfunction\\b))",
"begin": "(?ix)(?=\\b(?:character|class|complex|double\\s*precision|double\\s*complex|integer|logical|real|type)\\b(?![^:'\";!\\n]*\\bfunction\\b))",
"end": "(?=[;!\\n])",
"patterns": [
{
Expand Down Expand Up @@ -4010,8 +4010,7 @@
"function-definition": {
"comment": "Function program unit. Introduced in the Fortran 1977 standard.",
"name": "meta.function.fortran",
"comment2": "Escape :: ( , if they are before function. These are non-fixed width lookbehinds but they seem to work",
"begin": "(?i)(?=([^'\";!\\n](?!\\bend))*(?:(?<!\\(\\s*|::\\s*|,\\s*))\\bfunction\\b)",
"begin": "(?i)(?=([^:'\";!\\n](?!\\bend)(?!\\bsubroutine\\b))*\\bfunction\\b)",
"end": "(?=[;!\\n])",
"patterns": [
{
Expand Down Expand Up @@ -4094,8 +4093,8 @@
{
"comment": "Specification and execution block.",
"name": "meta.block.specification.function.fortran",
"begin": "(?i)(?!(?:end\\s*[;!\\n]|end\\s*function\\b))",
"end": "(?i)(?=(?:end\\s*[;!\\n]|end\\s*function\\b))",
"begin": "(?i)(?!\\b(?:end\\s*[;!\\n]|end\\s*function\\b))",
"end": "(?i)(?=\\b(?:end\\s*[;!\\n]|end\\s*function\\b))",
"patterns": [
{
"comment": "Contains block.",
Expand All @@ -4106,7 +4105,7 @@
"name": "keyword.control.contains.fortran"
}
},
"end": "(?i)(?=\\s*(?:end\\s*[;!\\n]|end\\s*function\\b))",
"end": "(?i)(?=(?:end\\s*[;!\\n]|end\\s*function\\b))",
"patterns": [
{
"include": "$base"
Expand Down Expand Up @@ -4350,7 +4349,7 @@
"subroutine-definition": {
"comment": "Subroutine program unit. Introduced in the Fortran 1977 standard.",
"name": "meta.subroutine.fortran",
"begin": "(?i)(?=([^'\";!\\n](?!\\bend))*(?:(?<!::\\s*))\\bsubroutine\\b)",
"begin": "(?i)(?=([^:'\";!\\n](?!\\bend))*\\bsubroutine\\b)",
"end": "(?=[;!\\n])",
"patterns": [
{
Expand Down Expand Up @@ -4542,7 +4541,7 @@
"type-specification-statements": {
"name": "meta.specification.type.fortran",
"comment": "Supported types for function and escape :: if function is used as a variable name (which is bad practice).",
"begin": "(?ix)(?=\\b(?:character|class|complex|double\\s*precision|double\\s*complex|integer|logical|real|type|dimension)\\b(?![^'\";!\\n]*(?<!\\(\\s*|::\\s*)\\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
3 changes: 0 additions & 3 deletions test/resources/function_subroutine_definitions.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
interface function_subroutine_definitions

! Normal subroutine
subroutine sub( arg )
Expand Down Expand Up @@ -46,5 +45,3 @@ end subroutine sub_with_sub
subroutine sub_with_fun( function )
integer, intent(inout) :: function
end subroutine sub_with_fun

end interface function_subroutine_definitions
Loading