Skip to content

Commit

Permalink
Create extension wide constants registry
Browse files Browse the repository at this point in the history
  • Loading branch information
ryu1kn committed Nov 4, 2016
1 parent bf2a7b4 commit caf55bc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/app-integrator.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

'use strict';

const EXTENSION_NAMESPACE = 'textmarker';
const Const = require('./const');

class AppIntegrator {

Expand All @@ -26,14 +26,14 @@ class AppIntegrator {
_registerCommands(context) {
const app = this._app;
const disposable = this._vscode.commands.registerCommand(
`${EXTENSION_NAMESPACE}.clearAllHighlight`, app.clearAllHighlight.bind(app));
`${Const.EXTENSION_NAME}.clearAllHighlight`, app.clearAllHighlight.bind(app));
context.subscriptions.push(disposable);
}

_registerTextEditorCommands(context) {
const app = this._app;
const disposable = this._vscode.commands.registerTextEditorCommand(
`${EXTENSION_NAMESPACE}.markText`, app.markText.bind(app));
`${Const.EXTENSION_NAME}.markText`, app.markText.bind(app));
context.subscriptions.push(disposable);
}

Expand Down
4 changes: 3 additions & 1 deletion lib/config-store.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@

'use strict';

const Const = require('./const');

class ConfigStore {
constructor(params) {
this._workspace = params.workspace;
}

get(configName) {
const extensionConfig = this._workspace.getConfiguration('textmarker');
const extensionConfig = this._workspace.getConfiguration(Const.EXTENSION_NAME);
return extensionConfig.get(configName);
}
}
Expand Down
6 changes: 6 additions & 0 deletions lib/const.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

module.exports = {

EXTENSION_NAME: 'textmarker'

};

0 comments on commit caf55bc

Please sign in to comment.