Skip to content

Commit 4b4de8f

Browse files
committed
Minor tweaks
1 parent fe62e8d commit 4b4de8f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@
372372
{
373373
"command": "editor.action.inspectTMScopes",
374374
"group": "navigation@6",
375-
"when": "view == TextMate"
375+
"when": "view == TextMate || view == TextMate-Call"
376376
},
377377
{
378378
"command": "textmate.tree-view",

src/extension.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ export async function activate(context: vscode.ExtensionContext) {
6262
vscode.languages.registerDocumentHighlightProvider(DocumentSelector, DocumentHighlightProvider), // Context aware cursor highlights
6363
vscode.languages.registerOnTypeFormattingEditProvider(DocumentSelector, OnTypeFormattingEditProvider, '}', ']', ':', ','), // Auto Format on certain characters
6464
vscode.languages.registerDocumentFormattingEditProvider(DocumentSelector, DocumentFormattingEditProvider), // right-click => Format Document
65+
vscode.languages.registerDocumentRangeFormattingEditProvider(DocumentSelector, DocumentRangeFormattingEditProvider), // right-click => Format Selection
6566
// vscode.languages.registerDocumentSemanticTokensProvider(DocumentSelector, DocumentSemanticTokensProvider, SemanticTokensLegend), // Context aware syntax highlighting
6667
// vscode.languages.registerDocumentRangeSemanticTokensProvider(DocumentSelector, DocumentRangeSemanticTokensProvider, SemanticTokensLegend), // Context aware syntax highlighting
67-
vscode.languages.registerDocumentRangeFormattingEditProvider(DocumentSelector, DocumentRangeFormattingEditProvider), // right-click => Format Selection
6868
);
6969

7070
// vscode.window.showInformationMessage(`Extension ${(performance.now() - start).toFixed(3)}ms`);
@@ -92,7 +92,7 @@ export function stringify(this: any, key: string, value: any): any {
9292
if (typeof value === 'undefined') {
9393
return "<undefined>";
9494
}
95-
if (value == null) {
95+
if (value === null) {
9696
return null;
9797
}
9898
if (value instanceof Map) {
@@ -109,6 +109,9 @@ export function stringify(this: any, key: string, value: any): any {
109109

110110

111111
export function closeEnoughQuestionMark(distance: number, text: string): boolean {
112+
if (typeof distance != 'number') {
113+
return false;
114+
}
112115
return distance < 1.5 * Math.sqrt(text.length); // more lenient for longer words
113116
}
114117

@@ -120,7 +123,7 @@ type wagnerFischerResult = {
120123
/** Wagner–Fischer algorithm is a dynamic programming algorithm that computes the edit distance between two strings of characters */
121124
export function wagnerFischer(word: string, directory: string[]): { distance: number, index: number, string: string; }[];
122125
/** Interestingly this also works with arrays of strings */
123-
export function wagnerFischer(words: string[], directorys: string[][]): { distance: number, index: number, string: string[]; }[];
126+
export function wagnerFischer(words: string[], directories: string[][]): { distance: number, index: number, string: string[]; }[];
124127
export function wagnerFischer(word: string | string[], directory: string[] | string[][]): wagnerFischerResult[] {
125128
const distances: wagnerFischerResult[] = [];
126129
let index = 0;

0 commit comments

Comments
 (0)