-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* makes helpView dynamic by parsing user keybindings (#24) * makes helpview use 3 rows to avoid wrapping * adds '-' key to grammar
- Loading branch information
Showing
6 changed files
with
79 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
import { window, workspace } from 'vscode'; | ||
import MagitUtils from '../utils/magitUtils'; | ||
import { HelpView } from '../views/helpView'; | ||
import { views } from '../extension'; | ||
import { views, logPath } from '../extension'; | ||
import { MagitRepository } from '../models/magitRepository'; | ||
import * as path from 'path'; | ||
|
||
export async function magitHelp(repository: MagitRepository) { | ||
|
||
let keybindingsPath = path.join(logPath, '..', '..', '..', '..', 'User', 'keybindings.json'); | ||
let userKeyBindings = []; | ||
|
||
try { | ||
userKeyBindings = await workspace.openTextDocument(keybindingsPath).then(document => | ||
JSON.parse( | ||
document | ||
.getText() | ||
.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '') | ||
) | ||
); | ||
} catch { } | ||
|
||
const uri = HelpView.encodeLocation(repository); | ||
views.set(uri.toString(), new HelpView(uri)); | ||
views.set(uri.toString(), new HelpView(uri, userKeyBindings)); | ||
workspace.openTextDocument(uri).then(doc => window.showTextDocument(doc, { viewColumn: MagitUtils.oppositeActiveViewColumn(), preserveFocus: true, preview: false })); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ const config = { | |
use: [ | ||
{ | ||
options: { | ||
|
||
configFile: 'tsconfig.json' | ||
}, | ||
loader: 'ts-loader' | ||
} | ||
|