103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# File 'lib/ruby_lsp/ruby_lsp_slim/addon.rb', line 103
def text_document_did_open(message)
text_document = message.dig(:params, :textDocument)
uri = text_document[:uri]
path = uri.is_a?(URI::Generic) ? uri.to_standardized_path : uri.to_s
if text_document[:languageId] == "slim" || (path && File.extname(path) == ".slim")
@store.set(
uri: uri,
source: text_document[:text],
version: text_document[:version],
language_id: :slim
)
document = @store.get(uri)
if document.past_expensive_limit? && uri.respond_to?(:scheme) && uri.scheme == "file"
send_message(
Notification.new(
method: "window/logMessage",
params: Interface::LogMessageParams.new(
type: Constant::MessageType::WARNING,
message: "The file #{path} is too long. Semantic highlighting and diagnostics will be disabled."
)
)
)
end
else
super
end
end
|