Skip to content

Commit 659964c

Browse files
committed
don't open non-file uri
1 parent 1abeb31 commit 659964c

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

script/file-uri.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,8 @@ function m.decode(uri)
9494
return value
9595
end
9696

97+
function m.split(uri)
98+
return uri:match('([^:]*):?/?/?([^/]*)(.*)')
99+
end
100+
97101
return m

script/provider/diagnostic.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ function m.doDiagnostic(uri, isScopeDiag)
225225
local prog <close> = progress.create(scp, lang.script.WINDOW_DIAGNOSING, 0.5)
226226
prog:setMessage(ws.getRelativePath(uri))
227227

228-
log.debug('Diagnostic file:', uri)
228+
--log.debug('Diagnostic file:', uri)
229229

230230
local syntax = m.syntaxErrors(uri, state)
231231

@@ -235,7 +235,7 @@ function m.doDiagnostic(uri, isScopeDiag)
235235
tracy.ZoneBeginN 'mergeSyntaxAndDiags'
236236
local _ <close> = tracy.ZoneEnd
237237
local full = mergeDiags(syntax, lastDiag, diags)
238-
log.debug(('Pushed [%d] results'):format(full and #full or 0))
238+
--log.debug(('Pushed [%d] results'):format(full and #full or 0))
239239
if not full then
240240
m.clear(uri)
241241
return

script/provider/provider.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,13 @@ m.register 'workspace/didRenameFiles' {
225225
m.register 'textDocument/didOpen' {
226226
---@async
227227
function (params)
228-
local doc = params.textDocument
229-
local uri = files.getRealUri(doc.uri)
228+
local doc = params.textDocument
229+
local scheme = furi.split(doc.uri)
230+
if scheme ~= 'file' then
231+
return
232+
end
233+
local uri = files.getRealUri(doc.uri)
234+
log.debug('didOpen', uri)
230235
workspace.awaitReady(uri)
231236
local text = doc.text
232237
files.setText(uri, text, true, function (file)

0 commit comments

Comments
 (0)