Skip to content

Commit

Permalink
Rename context key
Browse files Browse the repository at this point in the history
  • Loading branch information
svsool committed Jul 20, 2020
1 parent 3a10093 commit df2f262
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@
"menus": {
"editor/context": [
{
"when": "editorLangId == markdown && memo:cursorAtExistingReference",
"when": "editorLangId == markdown && memo:refUnderCursorExists",
"group": "memo",
"command": "memo.openReferenceInDefaultApp"
}
],
"commandPalette": [
{
"command": "memo.openReferenceInDefaultApp",
"when": "editorLangId == markdown && memo:cursorAtExistingReference"
"when": "editorLangId == markdown && memo:refUnderCursorExists"
}
]
},
Expand Down
10 changes: 5 additions & 5 deletions src/extensions/referenceContextWatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { window, workspace, commands, ExtensionContext } from 'vscode';

import { getRefUriUnderCursor } from '../utils';

const updateReferenceContext = () =>
commands.executeCommand('setContext', 'memo:cursorAtExistingReference', !!getRefUriUnderCursor());
const updateRefExistsContext = () =>
commands.executeCommand('setContext', 'memo:refUnderCursorExists', !!getRefUriUnderCursor());

export const activate = (context: ExtensionContext) => {
context.subscriptions.push(
window.onDidChangeTextEditorSelection(updateReferenceContext),
window.onDidChangeActiveTextEditor(updateReferenceContext),
workspace.onDidChangeTextDocument(updateReferenceContext),
window.onDidChangeTextEditorSelection(updateRefExistsContext),
window.onDidChangeActiveTextEditor(updateRefExistsContext),
workspace.onDidChangeTextDocument(updateRefExistsContext),
);
};

0 comments on commit df2f262

Please sign in to comment.