lib/steep/server/code_worker.rb in steep-0.16.3 vs lib/steep/server/code_worker.rb in steep-0.17.0

- old
+ new

@@ -45,22 +45,22 @@ source = target.source_files[path] target.type_check(target_sources: [source], validate_signatures: false) Steep.logger.info "Finished type checking: #{path}@#{target.name}" - diagnostics = source_diagnostics(source) + diagnostics = source_diagnostics(source, target.options) writer.write( method: :"textDocument/publishDiagnostics", params: LSP::Interface::PublishDiagnosticsParams.new( uri: URI.parse(project.absolute_path(path).to_s).tap {|uri| uri.scheme = "file"}, diagnostics: diagnostics ) ) end - def source_diagnostics(source) + def source_diagnostics(source, options) case status = source.status when Project::SourceFile::ParseErrorStatus [] when Project::SourceFile::AnnotationSyntaxErrorStatus [ @@ -78,10 +78,10 @@ ) ) ) ] when Project::SourceFile::TypeCheckStatus - status.typing.errors.map do |error| + status.typing.errors.select {|error| options.error_to_report?(error) }.map do |error| loc = error.location_to_str LSP::Interface::Diagnostic.new( message: StringIO.new.tap {|io| error.print_to(io) }.string.gsub(/\A#{Regexp.escape(loc)}: /, "").chomp, severity: LSP::Constant::DiagnosticSeverity::ERROR,