Skip to content
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

- Fixed bug with Fixed Format references being incorrectly detected in comments
([#447](https://github.com/fortran-lang/fortls/issues/447))
- Fixed bug with where form feed characters broke LSP features
([#443](https://github.com/fortran-lang/fortls/issues/443))

## 3.1.2

Expand Down
9 changes: 7 additions & 2 deletions fortls/parsers/internal/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,11 @@ def find_external(
return False


def splitlines(text: str) -> list[str]:
"""Split text into lines by \r\n, \n, or \r"""
return re.split(r"\n|\r\n?", text)


class FortranFile:
def __init__(self, path: str = None, pp_suffixes: list = None):
self.path: str = path
Expand Down Expand Up @@ -900,7 +905,7 @@ def load_from_disk(self) -> tuple[str | None, bool | None]:
return None, False

self.hash = hash
self.contents_split = contents.splitlines()
self.contents_split = splitlines(contents)
self.fixed = detect_fixed_format(self.contents_split)
self.contents_pp = self.contents_split
self.nLines = len(self.contents_split)
Expand Down Expand Up @@ -956,7 +961,7 @@ def check_change_reparse(line_no: int) -> bool:
if len(text) == 0:
text_split = [""]
else:
text_split = text.splitlines()
text_split = splitlines(text)
# Check for ending newline
if (text[-1] == "\n") or (text[-1] == "\r"):
text_split.append("")
Expand Down