Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move commandline history to XDG_CACHE_HOME or %APPDATA% #2889

Merged
merged 5 commits into from
Jul 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,11 @@
"postinstall": "node ./node_modules/vscode/bin/install"
},
"dependencies": {
"appdirectory": "0.1.0",
"clipboardy": "1.2.3",
"diff-match-patch": "1.0.1",
"lodash": "4.17.10",
"mkdirp": "0.5.1",
"neovim-client": "2.1.0",
"promised-neovim-client": "2.0.2",
"untildify": "3.0.3",
Expand Down
4 changes: 3 additions & 1 deletion src/cmd_line/commandLineHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import * as path from 'path';
import { configuration } from '../configuration/configuration';
import { logger } from '../util/logger';

const mkdirp = require('mkdirp');

export class CommandLineHistory {
private static readonly _historyFileName = '.cmdline_history';
private _historyDir: string;
Expand Down Expand Up @@ -59,7 +61,7 @@ export class CommandLineHistory {
return new Promise<void>((resolve, reject) => {
try {
if (!fs.existsSync(this._historyDir)) {
fs.mkdirSync(this._historyDir, 0o775);
mkdirp.sync(this._historyDir, 0o775);
}
} catch (err) {
logger.error(
Expand Down
7 changes: 6 additions & 1 deletion src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { Position } from '../common/motion/position';
import { Range } from '../common/motion/range';
import { logger } from './logger';

const AppDirectory = require('appdirectory');

/**
* This is certainly quite janky! The problem we're trying to solve
* is that writing editor.selection = new Position() won't immediately
Expand Down Expand Up @@ -38,5 +40,8 @@ export async function getCursorsAfterSync(timeout: number = 0): Promise<Range[]>
}

export function getExtensionDirPath(): string {
return path.join(os.homedir(), '.VSCodeVim');
const dirs = new AppDirectory('VSCodeVim');
logger.debug("VSCodeVim Cache Directory: " + dirs.userCache());

return dirs.userCache();
}