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

Correct misspelled occurrences and occurred #28569

Merged
merged 2 commits into from
Jun 15, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions build/lib/tslint/noUnexternalizedStringsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
protected visitSourceFile(node: ts.SourceFile): void {
super.visitSourceFile(node);
Object.keys(this.usedKeys).forEach(key => {
let occurences = this.usedKeys[key];
if (occurences.length > 1) {
occurences.forEach(occurence => {
this.addFailure((this.createFailure(occurence.key.getStart(), occurence.key.getWidth(), `Duplicate key ${occurence.key.getText()} with different message value.`)));
let occurrences = this.usedKeys[key];
if (occurrences.length > 1) {
occurrences.forEach(occurrence => {
this.addFailure((this.createFailure(occurrence.key.getStart(), occurrence.key.getWidth(), `Duplicate key ${occurrence.key.getText()} with different message value.`)));
});
}
});
Expand Down Expand Up @@ -157,17 +157,17 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {

private recordKey(keyNode: ts.StringLiteral, messageNode: ts.Node) {
let text = keyNode.getText();
let occurences: KeyMessagePair[] = this.usedKeys[text];
if (!occurences) {
occurences = [];
this.usedKeys[text] = occurences;
let occurrences: KeyMessagePair[] = this.usedKeys[text];
if (!occurrences) {
occurrences = [];
this.usedKeys[text] = occurrences;
}
if (messageNode) {
if (occurences.some(pair => pair.message ? pair.message.getText() === messageNode.getText() : false)) {
if (occurrences.some(pair => pair.message ? pair.message.getText() === messageNode.getText() : false)) {
return;
}
}
occurences.push({ key: keyNode, message: messageNode });
occurrences.push({ key: keyNode, message: messageNode });
}

private findDescribingParent(node: ts.Node): { callInfo?: { callExpression: ts.CallExpression, argIndex: number }, ignoreUsage?: boolean; } {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/base/common/errorMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function detectSystemErrorMessage(exception: any): string {

// See https://nodejs.org/api/errors.html#errors_class_system_error
if (typeof exception.code === 'string' && typeof exception.errno === 'number' && typeof exception.syscall === 'string') {
return nls.localize('nodeExceptionMessage', "A system error occured ({0})", exception.message);
return nls.localize('nodeExceptionMessage', "A system error occurred ({0})", exception.message);
}

return exception.message;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/base/common/marked/raw.marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ function marked(src, opt, callback) {
} catch (e) {
e.message += '\nPlease report this to https://github.com/chjj/marked.';
if ((opt || marked.defaults).silent) {
return '<p>An error occured:</p><pre>'
return '<p>An error occurred:</p><pre>'
+ escape(e.message + '', true)
+ '</pre>';
}
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/browser/controller/mouseHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export class MouseHandler extends ViewEventHandler {
}
let actualMouseMoveTime = e.timestamp;
if (actualMouseMoveTime < this.lastMouseLeaveTime) {
// Due to throttling, this event occured before the mouse left the editor, therefore ignore it.
// Due to throttling, this event occurred before the mouse left the editor, therefore ignore it.
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/browser/standalone/standaloneLanguages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export function registerDocumentSymbolProvider(languageId: string, provider: mod
}

/**
* Register a document highlight provider (used by e.g. highlight occurences).
* Register a document highlight provider (used by e.g. highlight occurrences).
*/
export function registerDocumentHighlightProvider(languageId: string, provider: modes.DocumentHighlightProvider): IDisposable {
return modes.DocumentHighlightProviderRegistry.register(languageId, provider);
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/common/controller/cursorTypeOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export class TypeOperations {
const selection = selections[i];
if (!selection.isEmpty()) {
// looks like https://github.com/Microsoft/vscode/issues/2773
// where a cursor operation occured before a canceled composition
// where a cursor operation occurred before a canceled composition
// => ignore composition
commands[i] = null;
continue;
Expand Down
10 changes: 5 additions & 5 deletions src/vs/editor/contrib/find/common/findController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ export class SelectHighlightsAction extends AbstractSelectHighlightsAction {
constructor() {
super({
id: 'editor.action.selectHighlights',
label: nls.localize('selectAllOccurencesOfFindMatch', "Select All Occurrences of Find Match"),
label: nls.localize('selectAllOccurrencesOfFindMatch', "Select All Occurrences of Find Match"),
alias: 'Select All Occurrences of Find Match',
precondition: null,
kbOpts: {
Expand Down Expand Up @@ -1005,10 +1005,10 @@ export class SelectionHighlighter extends Disposable implements editorCommon.IEd
return null;
}

const hasFindOccurences = DocumentHighlightProviderRegistry.has(model);
const hasFindOccurrences = DocumentHighlightProviderRegistry.has(model);
if (r.currentMatch) {
// This is an empty selection
if (hasFindOccurences) {
if (hasFindOccurrences) {
// Do not interfere with semantic word highlighting in the no selection case
return null;
}
Expand Down Expand Up @@ -1070,7 +1070,7 @@ export class SelectionHighlighter extends Disposable implements editorCommon.IEd
}

const model = this.editor.getModel();
const hasFindOccurences = DocumentHighlightProviderRegistry.has(model);
const hasFindOccurrences = DocumentHighlightProviderRegistry.has(model);

let allMatches = model.findMatches(this.state.searchText, true, false, this.state.matchCase, this.state.wordSeparators, false).map(m => m.range);
allMatches.sort(Range.compareRangesUsingStarts);
Expand Down Expand Up @@ -1108,7 +1108,7 @@ export class SelectionHighlighter extends Disposable implements editorCommon.IEd
return {
range: r,
// Show in overviewRuler only if model has no semantic highlighting
options: (hasFindOccurences ? SelectionHighlighter._SELECTION_HIGHLIGHT : SelectionHighlighter._SELECTION_HIGHLIGHT_OVERVIEW)
options: (hasFindOccurrences ? SelectionHighlighter._SELECTION_HIGHLIGHT : SelectionHighlighter._SELECTION_HIGHLIGHT_OVERVIEW)
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ suite('FindController', () => {
});
});

test('issue #5400: "Select All Occurences of Find Match" does not select all if find uses regex', () => {
test('issue #5400: "Select All Occurrences of Find Match" does not select all if find uses regex', () => {
withMockCodeEditor([
'something',
'someething',
Expand Down
62 changes: 31 additions & 31 deletions src/vs/editor/contrib/links/browser/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const decoration = {
}),
};

class LinkOccurence {
class LinkOccurrence {

public static decoration(link: Link, useMetaKey: boolean): editorCommon.IModelDeltaDecoration {
return {
Expand All @@ -68,7 +68,7 @@ class LinkOccurence {
endLineNumber: link.range.endLineNumber,
endColumn: link.range.endColumn
},
options: LinkOccurence._getOptions(useMetaKey, false)
options: LinkOccurrence._getOptions(useMetaKey, false)
};
}

Expand All @@ -88,11 +88,11 @@ class LinkOccurence {
}

public activate(changeAccessor: editorCommon.IModelDecorationsChangeAccessor, useMetaKey: boolean): void {
changeAccessor.changeDecorationOptions(this.decorationId, LinkOccurence._getOptions(useMetaKey, true));
changeAccessor.changeDecorationOptions(this.decorationId, LinkOccurrence._getOptions(useMetaKey, true));
}

public deactivate(changeAccessor: editorCommon.IModelDecorationsChangeAccessor, useMetaKey: boolean): void {
changeAccessor.changeDecorationOptions(this.decorationId, LinkOccurence._getOptions(useMetaKey, false));
changeAccessor.changeDecorationOptions(this.decorationId, LinkOccurrence._getOptions(useMetaKey, false));
}
}

Expand All @@ -115,7 +115,7 @@ class LinkDetector implements editorCommon.IEditorContribution {
private openerService: IOpenerService;
private messageService: IMessageService;
private editorWorkerService: IEditorWorkerService;
private currentOccurences: { [decorationId: string]: LinkOccurence; };
private currentOccurrences: { [decorationId: string]: LinkOccurrence; };

constructor(
editor: ICodeEditor,
Expand Down Expand Up @@ -148,7 +148,7 @@ class LinkDetector implements editorCommon.IEditorContribution {

this.timeoutPromise = null;
this.computePromise = null;
this.currentOccurences = {};
this.currentOccurrences = {};
this.activeLinkDecorationId = null;
this.beginCompute();
}
Expand All @@ -162,7 +162,7 @@ class LinkDetector implements editorCommon.IEditorContribution {
}

private onModelChanged(): void {
this.currentOccurences = {};
this.currentOccurrences = {};
this.activeLinkDecorationId = null;
this.stop();
this.beginCompute();
Expand Down Expand Up @@ -202,28 +202,28 @@ class LinkDetector implements editorCommon.IEditorContribution {
const useMetaKey = (this.editor.getConfiguration().multiCursorModifier === 'altKey');
this.editor.changeDecorations((changeAccessor: editorCommon.IModelDecorationsChangeAccessor) => {
var oldDecorations: string[] = [];
let keys = Object.keys(this.currentOccurences);
let keys = Object.keys(this.currentOccurrences);
for (let i = 0, len = keys.length; i < len; i++) {
let decorationId = keys[i];
let occurance = this.currentOccurences[decorationId];
let occurance = this.currentOccurrences[decorationId];
oldDecorations.push(occurance.decorationId);
}

var newDecorations: editorCommon.IModelDeltaDecoration[] = [];
if (links) {
// Not sure why this is sometimes null
for (var i = 0; i < links.length; i++) {
newDecorations.push(LinkOccurence.decoration(links[i], useMetaKey));
newDecorations.push(LinkOccurrence.decoration(links[i], useMetaKey));
}
}

var decorations = changeAccessor.deltaDecorations(oldDecorations, newDecorations);

this.currentOccurences = {};
this.currentOccurrences = {};
this.activeLinkDecorationId = null;
for (let i = 0, len = decorations.length; i < len; i++) {
var occurance = new LinkOccurence(links[i], decorations[i]);
this.currentOccurences[occurance.decorationId] = occurance;
var occurance = new LinkOccurrence(links[i], decorations[i]);
this.currentOccurrences[occurance.decorationId] = occurance;
}
});
}
Expand All @@ -232,11 +232,11 @@ class LinkDetector implements editorCommon.IEditorContribution {
const useMetaKey = (this.editor.getConfiguration().multiCursorModifier === 'altKey');
if (this.isEnabled(mouseEvent, withKey)) {
this.cleanUpActiveLinkDecoration(); // always remove previous link decoration as their can only be one
var occurence = this.getLinkOccurence(mouseEvent.target.position);
if (occurence) {
var occurrence = this.getLinkOccurrence(mouseEvent.target.position);
if (occurrence) {
this.editor.changeDecorations((changeAccessor) => {
occurence.activate(changeAccessor, useMetaKey);
this.activeLinkDecorationId = occurence.decorationId;
occurrence.activate(changeAccessor, useMetaKey);
this.activeLinkDecorationId = occurrence.decorationId;
});
}
} else {
Expand All @@ -247,10 +247,10 @@ class LinkDetector implements editorCommon.IEditorContribution {
private cleanUpActiveLinkDecoration(): void {
const useMetaKey = (this.editor.getConfiguration().multiCursorModifier === 'altKey');
if (this.activeLinkDecorationId) {
var occurence = this.currentOccurences[this.activeLinkDecorationId];
if (occurence) {
var occurrence = this.currentOccurrences[this.activeLinkDecorationId];
if (occurrence) {
this.editor.changeDecorations((changeAccessor) => {
occurence.deactivate(changeAccessor, useMetaKey);
occurrence.deactivate(changeAccessor, useMetaKey);
});
}

Expand All @@ -262,20 +262,20 @@ class LinkDetector implements editorCommon.IEditorContribution {
if (!this.isEnabled(mouseEvent)) {
return;
}
var occurence = this.getLinkOccurence(mouseEvent.target.position);
if (!occurence) {
var occurrence = this.getLinkOccurrence(mouseEvent.target.position);
if (!occurrence) {
return;
}
this.openLinkOccurence(occurence, mouseEvent.hasSideBySideModifier);
this.openLinkOccurrence(occurrence, mouseEvent.hasSideBySideModifier);
}

public openLinkOccurence(occurence: LinkOccurence, openToSide: boolean): void {
public openLinkOccurrence(occurrence: LinkOccurrence, openToSide: boolean): void {

if (!this.openerService) {
return;
}

const { link } = occurence;
const { link } = occurrence;

link.resolve().then(uri => {
// open the uri
Expand All @@ -293,7 +293,7 @@ class LinkDetector implements editorCommon.IEditorContribution {
}).done(null, onUnexpectedError);
}

public getLinkOccurence(position: Position): LinkOccurence {
public getLinkOccurrence(position: Position): LinkOccurrence {
var decorations = this.editor.getModel().getDecorationsInRange({
startLineNumber: position.lineNumber,
startColumn: position.column,
Expand All @@ -303,9 +303,9 @@ class LinkDetector implements editorCommon.IEditorContribution {

for (var i = 0; i < decorations.length; i++) {
var decoration = decorations[i];
var currentOccurence = this.currentOccurences[decoration.id];
if (currentOccurence) {
return currentOccurence;
var currentOccurrence = this.currentOccurrences[decoration.id];
if (currentOccurrence) {
return currentOccurrence;
}
}

Expand Down Expand Up @@ -354,9 +354,9 @@ class OpenLinkAction extends EditorAction {
return;
}

let link = linkDetector.getLinkOccurence(editor.getPosition());
let link = linkDetector.getLinkOccurrence(editor.getPosition());
if (link) {
linkDetector.openLinkOccurence(link, false);
linkDetector.openLinkOccurrence(link, false);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ class WordHighlighter {
}

// All the effort below is trying to achieve this:
// - when cursor is moved to a word, trigger immediately a findOccurences request
// - 250ms later after the last cursor move event, render the occurences
// - when cursor is moved to a word, trigger immediately a findOccurrences request
// - 250ms later after the last cursor move event, render the occurrences
// - no flickering!

var currentWordRange = new Range(lineNumber, word.startColumn, lineNumber, word.endColumn);
Expand Down
2 changes: 1 addition & 1 deletion src/vs/monaco.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3954,7 +3954,7 @@ declare module monaco.languages {
export function registerDocumentSymbolProvider(languageId: string, provider: DocumentSymbolProvider): IDisposable;

/**
* Register a document highlight provider (used by e.g. highlight occurences).
* Register a document highlight provider (used by e.g. highlight occurrences).
*/
export function registerDocumentHighlightProvider(languageId: string, provider: DocumentHighlightProvider): IDisposable;

Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/files/common/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export enum FileChangeType {
export interface IFileChange {

/**
* The type of change that occured to the file.
* The type of change that occurred to the file.
*/
type: FileChangeType;

Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/search/common/replace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class ReplacePattern {
}

if (substrFrom === 0) {
// no replacement occured
// no replacement occurred
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/node/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export function createApiFactory(
console.warn('Edits from command ' + id + ' were not applied.');
}
}, (err) => {
console.warn('An error occured while running command ' + id, err);
console.warn('An error occurred while running command ' + id, err);
});
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export class ConfigurationResolverService implements IConfigurationResolverServi
}

// We need a map from interactive variables to keys because we only want to trigger an command once per key -
// even though it might occure multiple times in configuration #7026.
// even though it might occur multiple times in configuration #7026.
const interactiveVariablesToSubstitutes: { [interactiveVariable: string]: { object: any, key: string }[] } = {};
const findInteractiveVariables = (object: any) => {
Object.keys(object).forEach(key => {
Expand Down