Skip to content

Commit

Permalink
fix: hover provider shouldn't recommend Ctrl+click for missing notes …
Browse files Browse the repository at this point in the history
…unless configured (#1276)
  • Loading branch information
Kaan Genç committed Sep 3, 2021
1 parent b0298e8 commit cc037b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/plugin-core/src/features/ReferenceHoverProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
getReferenceAtPosition,
isUncPath,
} from "../utils/md";
import { DendronWorkspace, getEngine } from "../workspace";
import { DendronWorkspace, getEngine, getWS } from "../workspace";
import _ from "lodash";
import { Logger } from "../logger";

Expand Down Expand Up @@ -67,7 +67,9 @@ export default class ReferenceHoverProvider implements vscode.HoverProvider {
const vaultName = refAtPos.vaultName
? ` in vault "${refAtPos.vaultName}"`
: "";
return `Note ${refAtPos.ref}${vaultName} is missing, Ctrl+click or use "Dendron: Goto Note" command to create it.`;
const ctrlClickToCreate =
getWS().config.noAutoCreateOnDefinition === false ? "Ctrl+Click or " : "";
return `Note ${refAtPos.ref}${vaultName} is missing, ${ctrlClickToCreate}use "Dendron: Goto Note" command to create it.`;
}

/** Returns a message if this is a non-dendron URI. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ suite("ReferenceProvider", function () {
await AssertUtils.assertInString({
body: hover!.contents.join(""),
match: [
`Note target is missing, Ctrl+click or use "Dendron: Goto Note" command to create it.`,
`Note target is missing`,
`use "Dendron: Goto Note" command`,
],
});
done();
Expand Down

0 comments on commit cc037b6

Please sign in to comment.