File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4747 "invalidselectstarexpansion" ,
4848 "noselectstar" ,
4949 "nomissingaudits" ,
50+ "nomissingowner" ,
5051 ],
5152 ),
5253)
Original file line number Diff line number Diff line change @@ -421,12 +421,24 @@ def _diagnostic_to_lsp_diagnostic(
421421 def _diagnostics_to_lsp_diagnostics (
422422 diagnostics : t .List [AnnotatedRuleViolation ],
423423 ) -> t .List [types .Diagnostic ]:
424- lsp_diagnostics : t .List [types .Diagnostic ] = []
424+ """
425+ Converts a list of AnnotatedRuleViolations to a list of LSP diagnostics. It will remove duplicates based on the message and range.
426+ """
427+ lsp_diagnostics = {}
425428 for diagnostic in diagnostics :
426429 lsp_diagnostic = SQLMeshLanguageServer ._diagnostic_to_lsp_diagnostic (diagnostic )
427430 if lsp_diagnostic is not None :
428- lsp_diagnostics .append (lsp_diagnostic )
429- return lsp_diagnostics
431+ # Create a unique key combining message and range
432+ diagnostic_key = (
433+ lsp_diagnostic .message ,
434+ lsp_diagnostic .range .start .line ,
435+ lsp_diagnostic .range .start .character ,
436+ lsp_diagnostic .range .end .line ,
437+ lsp_diagnostic .range .end .character ,
438+ )
439+ if diagnostic_key not in lsp_diagnostics :
440+ lsp_diagnostics [diagnostic_key ] = lsp_diagnostic
441+ return list (lsp_diagnostics .values ())
430442
431443 @staticmethod
432444 def _uri_to_path (uri : str ) -> Path :
You can’t perform that action at this time.
0 commit comments