Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(diagnostic): deepcopy diagnostics before clamping line numbers
The current 'clamp_line_numbers' implementation modifies diagnostics in place, which can have adverse downstream side effects. Before clamping line numbers, make a copy of the diagnostic. This commit also merges the 'clamp_line_numbers' method into a new 'get_diagnostics' local function which also implements the more general "get" method. The public 'vim.diagnostic.get()' API now just uses this function (without clamping). This has the added benefit that other internal API functions that need to use get() no longer have to go through vim.validate. Finally, reorganize the source code a bit by grouping all of the data structures together near the top of the file.
- Loading branch information
Showing
3 changed files
with
89 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -717,5 +717,3 @@ end | |
-- }}} | ||
|
||
return M | ||
|
||
-- vim: fdm=marker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters