Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
add(...values) {
// until https://github.com/eslint/eslint/issues/12117 is resolved:
// eslint-disable-next-line no-unused-vars
for (let val of values) {
if (!Disposable.isDisposable(val)) {
if (typeof val === "function") {
val = new Disposable(val);
} else {
console.error(
`val is of type ${typeof val}, was expected to be disposable or a function`
);
}
}
super.add(val);
}
}
}
activate(_) {
// Initialize.
this.linter = new Linter();
this.autocompleter = new Autocompleter();
// Events subscribed to in atom's system can be easily cleaned up with a
// CompositeDisposable
this.subscriptions = new CompositeDisposable();
this.subscriptions.add(atom.project.onDidChangePaths((projectPaths) => {
this.setProjectPaths(projectPaths);
}));
this.setProjectPaths(atom.project.getPaths());
this.subscriptions.add(new TooltipManager(this.editorService));
}
;
activate(_: ViewState) {
// Initialize.
this.linter = new Linter();
this.autocompleter = new Autocompleter();
// Events subscribed to in atom's system can be easily cleaned up with a
// CompositeDisposable
this.subscriptions = new CompositeDisposable();
this.subscriptions.add(
atom.project.onDidChangePaths((projectPaths: string[]) => {
this.setProjectPaths(projectPaths);
}));
this.setProjectPaths(atom.project.getPaths());
this.subscriptions.add(new TooltipManager(this.editorService));
};
constructor(options) {
this.element = document.createElement('select');
this.element.classList.add('select', 'element');
this.element.style.width = options.width;
this.emitter = new Emitter();
this.element.onchange = function(e){
var selectedOption = this.element.options[this.element.selectedIndex];
this.emitter.emit('change', {text: selectedOption.text, value: selectedOption.value});
}.bind(this);
}
constructor(props) {
this.props = props;
etch.initialize(this);
this.element.addEventListener('focusin', this.rememberLastFocus);
this.subscriptions = new CompositeDisposable(
this.props.commandRegistry.add(this.element, {
'tool-panel:unfocus': this.blur,
'core:focus-next': this.advanceFocus,
'core:focus-previous': this.retreatFocus,
}),
new Disposable(() => this.element.removeEventListener('focusin', this.rememberLastFocus)),
);
}
function on() {
subscriptions = new CompositeDisposable();
subscriptions.add(atom.config.observe('linter-markdown.presetRecommendedWithoutConfig', (value) => {
presetRecommendedWithoutConfig = value;
}));
subscriptions.add(atom.config.observe('linter-markdown.presetConsistentWithoutConfig', (value) => {
presetConsistentWithoutConfig = value;
}));
}
activate() {
this.subscriptions = new CompositeDisposable();
this.subscriptions.add(
atom.packages.onDidActivateInitialPackages(function() {
if (!atom.inSpecMode()) {
require('atom-package-deps').install('atom-ternjs', true);
}
})
);
manager.activate();
}
function getLastNonWhitespaceChar(buffer: Atom.TextBuffer, pos: Atom.Point): string | undefined {
let lastChar: string | undefined
const range = new Atom.Range([0, 0], pos)
buffer.backwardsScanInRange(
/\S/,
range,
({matchText, stop}: {matchText: string; stop: () => void}) => {
lastChar = matchText
stop()
},
)
return lastChar
}
function getLastNonWhitespaceChar(buffer, pos) {
let lastChar;
const range = new Atom.Range([0, 0], pos);
buffer.backwardsScanInRange(/\S/, range, ({ matchText, stop }) => {
lastChar = matchText;
stop();
});
return lastChar;
}
function containsScope(scopes, matchScope) {
_getRange(start, end) {
let buf = this._editor.getBuffer();
return new Range(
buf.positionForCharacterIndex(start),
buf.positionForCharacterIndex(end)
);
}