Skip to content

Commit

Permalink
fix: use workspace config for non-file schemes
Browse files Browse the repository at this point in the history
For documents whose uri scheme is something other than `file`, fall back
to a configuration based on the workspace rather than trying to locate
one based on the file's path. Paths corresponding to non-`file` schemes
would not expected to be traversable, so no configuration is likely to
be found anyway.

This behavior is equivalent to the existing behavior for any untitled
document (e.g., opening a new file and manually setting its mode to "git
commit message").

Fixes #69
  • Loading branch information
joshbolduc committed Apr 6, 2021
1 parent e71cb57 commit 097237e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ async function getDiagnostics(doc: TextDocument) {

const sanitizedText = getCleanText(text);

const useWorkspaceConfig = doc.isUntitled || doc.uri.scheme !== 'file';

const [problems, commit] = await Promise.all([
runLint(
sanitizedText,
doc.isUntitled
useWorkspaceConfig
? workspace.workspaceFolders?.[0].uri.fsPath
: doc.uri.fsPath,
),
Expand Down

0 comments on commit 097237e

Please sign in to comment.