Skip to content

make sure column is defined#614

Merged
randy3k merged 3 commits intomasterfrom
fix609
Apr 21, 2023
Merged

make sure column is defined#614
randy3k merged 3 commits intomasterfrom
fix609

Conversation

@randy3k
Copy link
Member

@randy3k randy3k commented Apr 20, 2023

an attempt to fix #609

Copy link
Member

@renkun-ken renkun-ken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@randy3k
Copy link
Member Author

randy3k commented Apr 21, 2023

Let’s wait and see if @klmr could confirm that it fixes the issue.

@klmr
Copy link

klmr commented Apr 21, 2023

Unfortunately this does not fix the issue. And when logging the value of column I can see that it is -1 with the minimal test case from #609.

Of course the code could simply be modified to test for values ≤ 0 but maybe we should figure out why the value is negative in the first place. This seems to come directly from lintr::lint, correct?

Invoking that on the provided example file returns the following result:

structure(list(structure(list(filename = "/path/to/test.r",
    line_number = 2L, column_number = 0L, type = "style", message = "Indentation should be 4 spaces but is 0 spaces.",
    line = "b = 2", ranges = list(c(0L, 4L)), linter = "indentation_linter"), class = c("lint",
"list"))), class = c("lints", "list"))

@randy3k
Copy link
Member Author

randy3k commented Apr 21, 2023

In this case, the bug is actually triggered by code_point_to_unit which assumes that the input is always >=0. Hopefully it will fix the issue.

@klmr
Copy link

klmr commented Apr 21, 2023

Hallelujah, I think that fixes it. And it even returns the correct (rather than just an arbitrary) position for the diagnostic to the language client, I believe.

@randy3k randy3k merged commit b42e0e3 into master Apr 21, 2023
@randy3k
Copy link
Member Author

randy3k commented Apr 21, 2023

Great, let's merge it.

@randy3k randy3k deleted the fix609 branch April 21, 2023 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error in Neovim: “attempt to compare string with number”

3 participants