Skip to content

Commit

Permalink
Merge pull request #2651 from Shopify/ar/file-too-long-warning
Browse files Browse the repository at this point in the history
Reduce noise from "This file is too long" warning
  • Loading branch information
alexcrocha authored Oct 2, 2024
2 parents 3558809 + 8da3c96 commit ae70ebc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/ruby_lsp/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,18 @@ def text_document_did_open(message)
language_id: language_id,
)

if document.past_expensive_limit?
if document.past_expensive_limit? && text_document[:uri].scheme == "file"
log_message = <<~MESSAGE
The file #{text_document[:uri].path} is too long. For performance reasons, semantic highlighting and
diagnostics will be disabled.
MESSAGE

send_message(
Notification.new(
method: "window/showMessage",
params: Interface::ShowMessageParams.new(
method: "window/logMessage",
params: Interface::LogMessageParams.new(
type: Constant::MessageType::WARNING,
message: "This file is too long. For performance reasons, semantic highlighting and " \
"diagnostics will be disabled",
message: log_message,
),
),
)
Expand Down

0 comments on commit ae70ebc

Please sign in to comment.