-
-
Notifications
You must be signed in to change notification settings - Fork 52
Description
Describe the bug
Comments beginning using an exclamation point instead of a first column 'c' are checked against max_line_length instead of max_comment_line_length. In my opinion, the ideal behavior would be to check a line before an exclamation point to max_line_length and then check the comment after the exclamation point to max_comment_line_length. Visual example from Visual Studio Code:
To Reproduce
Using any fixed-form fortran source file with a ! comment passing the max line length,
fortls --debug_filepath test.f --debug_rootpath .. --debug_diagnostics --max_line_length 72 --max_comment_line_length -1
An example file follows:
program test
implicit none
c This is a comment line, it can go past the 72nd column as;dlfkjams;l ekrjm cw;elj
integer :: i, j, k
integer :: some_variable ! This is a comment, if it goes past the 72nd column
integer :: another_variable ! then it will trigger a warning with fortls using max_line_length=72.
i = 1
j = i + 1
k = i + j
some_variable = 10
another_variable = 20
end program test
This command with this example file produces warnings:
Testing "textDocument/publishDiagnostics" request:
File = "/Users/pharr/Downloads/test.f"
================================================================================
Reported Diagnostics:
5:WARNING "Line length exceeds "max_line_length" (72)"
6:WARNING "Line length exceeds "max_line_length" (72)"
5:WARNING "Line length exceeds "max_line_length" (72)"
6:WARNING "Line length exceeds "max_line_length" (72)"
================================================================================
Expected behavior
As summarized above -- this warning should only trigger if code the compiler will recognize as code passes the maximum line length column, not if a comment beginning with '!' does.
Setup information (please complete the following information):
- OS: macOS 15.5 24F74 arm64
- Python Version: 3.13.3
- fortls Version: 3.2.2
- Code editor: VS Code
- Using Modern Fortran 3.2.0
Configuration information (please complete the following information):
N/A
Additional context
N/A