Skip to content

Commit

Permalink
Merge pull request #692 from julia-vscode/nonwsopt
Browse files Browse the repository at this point in the history
add option to run linter on non-workspace files
  • Loading branch information
ZacLN committed May 11, 2020
2 parents 49afe6a + 339cb02 commit 936a813
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/languageserverinstance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ mutable struct LanguageServerInstance
SymbolServer.collect_extended_methods(SymbolServer.stdlibs),
false,
DocumentFormat.FormatOptions(),
true,
true,
StaticLint.LintOptions(),
:all,
Channel{Any}(Inf),
Expand Down
4 changes: 3 additions & 1 deletion src/requests/textdocument.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,10 @@ function mark_errors(doc, out = Diagnostic[])
return out
end

isunsavedfile(doc::Document) = startswith(doc._uri, "untitled:") # Not clear if this is consistent across editors.

function publish_diagnostics(doc::Document, server)
if server.runlinter && server.symbol_store_ready && is_workspace_file(doc)
if server.runlinter && server.symbol_store_ready && (is_workspace_file(doc) || isunsavedfile(doc))
publishDiagnosticsParams = PublishDiagnosticsParams(doc._uri, doc._version, doc.diagnostics)
else
publishDiagnosticsParams = PublishDiagnosticsParams(doc._uri, doc._version, Diagnostic[])
Expand Down

0 comments on commit 936a813

Please sign in to comment.