Skip to content
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.0.12 (2017-08-02)

- Add TextEditor.getTabLength()

### 1.0.11 (2017-08-02)

- Update package dependency versions
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qub-vscode",
"version": "1.0.11",
"version": "1.0.12",
"description": "A collection of common data structures and functions that make creating Visual Studio Code extensions easier.",
"files": [
"*.js",
Expand Down
5 changes: 5 additions & 0 deletions sources/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ export interface TextEditor {
*/
getIndent(): string;

/**
* Get the number of spaces that go into a single tab.
*/
getTabLength(): number;

/**
* Get the current newline string used by this editor (\n, \r\n, etc.).
*/
Expand Down
6 changes: 5 additions & 1 deletion sources/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class TextEditor implements interfaces.TextEditor {

this.setCursorIndex(startIndex + qub.getLength(text));

return
return
}

public getIndent(): string {
Expand All @@ -132,6 +132,10 @@ export class TextEditor implements interfaces.TextEditor {
this._indent = indent;
}

public getTabLength(): number {
return 2;
}

public getNewLine(): string {
return this._newline;
}
Expand Down
4 changes: 4 additions & 0 deletions sources/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ class TextEditor implements interfaces.TextEditor {
return this._textEditor.options.insertSpaces ? qub.repeat(" ", <number>this._textEditor.options.tabSize) : "\t";
}

public getTabLength(): number {
return this._textEditor.options.tabSize as number;
}

public getNewLine(): string {
return "\n";
}
Expand Down
1 change: 1 addition & 0 deletions tests/mocks.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ suite("Mocks", () => {
assert.deepStrictEqual(editor.getDocument(), undefined);
assert.deepStrictEqual(editor.getCursorIndex(), 0);
assert.deepStrictEqual(editor.getIndent(), " ");
assert.deepStrictEqual(editor.getTabLength(), 2);
assert.deepStrictEqual(editor.getNewLine(), "\n");
});
});
Expand Down