Commit Graph

46 Commits

Author SHA1 Message Date
Alex Dima
b164459bf8 Tweaks for #62079 2019-02-18 16:41:01 +01:00
David Lechner
5f70fddbfa Add editor.indentSize option
This is an attempt to address issue #10339.

Background:

Currently, the `editor.tabSize` option does two things - it specifies the width of the tab character and it specifies how many columns to advance when the tab key is pressed. However, there is code in the wild that has a mix of spaces and tabs that expects these two values to be different.

These generally use and indent size of 2 or 4 and spaces are used for indentation until the indent becomes >= 8. The tab character size is excpected to be 8 and groups of 8 spaces are replaced with a tab character. Indent levels end up looking like 2 spaces, 4 spaces, 6 spaces, 1 tab, 1 tab + 2 spaces, and so on.

Implementation:

In the editor options, a new option, `editor.indentSize` is added. This, in conjunction with `editor.tabSize` has the same semantics as `indent_size` and `tab_width` in the well known [EditorConfig specification][1].

> indent_size: a whole number defining the number of columns used for each indentation level and the width of soft tabs (when supported). When set to "tab", the value of tab_width (if specified) will be used.
>
> tab_width: a whole number defining the number of columns used to represent a tab character. This defaults to the value of indent_size and doesn't usually need to be specified.

[1]: editorconfig.org

The new `indentSize` option takes a numeric value or "tab" just as EditorConfig's `indent_size`. The default value is set to "tab" so that current default behavior of VS Code does not change and existing user settings will not break.

When getting the new `indentSize` option programatically, it always returns a numeric value (just as `tabSize` does when set to the deprecated "auto" value).

In the text editor model, a new property is added for `indentSize`. Unlike the configuration options where the value of one property influences the other, In this code `tabSize` now should only mean "the width of the tab character" and `indentSize` should only mean "how may columns is one indent".

The cursor operations and shift command are updated to reflect these new semantics.
2019-02-18 12:17:13 +01:00
Rob Lourens
ef2547d547 replace void 0 with undefined 2019-01-03 11:20:19 -08:00
Johannes Rieken
653280d133 debt - Thenable -> Promise 2018-12-13 11:31:54 +01:00
Matt Bierner
0b1d0da7af Prefer to use .then(void 0, ..) over .then(null, ..)
ES6 promises like using undefined as their first argument instead of null. Both should behave the same behavior
2018-12-11 21:59:32 -08:00
Alex Dima
eb87600bd3 Use more URIs 2018-11-07 19:48:14 +01:00
Alex Dima
17454d4e88 Organize imports 2018-10-23 09:54:11 +02:00
Matt Bierner
0318e90c93 Add null type annotations for the common x: T = null pattern
In these cases, the programmer has explicitly indicated that the type should be nullable
2018-10-11 14:13:20 -07:00
Matt Bierner
be38e56996 Remove duplicate blank lines at the start of some files 2018-10-02 16:28:19 -07:00
Matt Bierner
8087b0a8d8 Remove use strict directives in main vs code ts files (part 2)
We compile using the alwaysStrict flag so these directives are not needed

This part removes most `use strict` directives that are right after the file header
2018-10-02 16:11:05 -07:00
Johannes Rieken
81b995a25d debt - less TPromise usage 2018-10-01 14:01:17 +02:00
Alex Dima
591e83f8a4 Reduce usage of TPromise in extHost.protocol 2018-09-04 16:04:53 +02:00
Alex Dima
1bef172fe1 Avoid no-op calls to the renderer 2018-09-04 12:19:55 +02:00
Johannes Rieken
9cc1fc914d fix #55163 2018-07-26 19:10:58 +02:00
Johannes Rieken
c47296282a type converters, use namespace for ViewColumn 2018-05-04 18:49:40 +02:00
Johannes Rieken
9f6053242f type converters, use namespace for Position 2018-05-04 18:49:39 +02:00
Johannes Rieken
dfb070c277 type converter, use namespace for Range 2018-05-04 18:49:39 +02:00
Johannes Rieken
069bbd81e4 type converters, use namespace for Selection 2018-05-04 18:49:39 +02:00
Matt Bierner
27a17935b8 Move webview to use onDidChangeViewState event
After discussions, we settled on making the webview private unlike `TextEditors`. This means that webview events will live on the webview object itself

Fixes #44571
2018-03-20 14:30:39 -07:00
Alex Dima
20ed3d9632 Fixes #44424: Add proposed API - TextEditor.visibleRanges 2018-02-26 21:28:09 +01:00
Matt Bierner
2038b8fc7f Webview API prototype 3 (#44307)
* Webview API prototype 3

Part of #43713

Third try at refining the webview api. This pass reworks  #44165.  Major changes:

- Adds an `id` field to webviews. The id is provided by the extension and identifies the webview. It is used with the new event handling apis.

- Adds a new `onDidChangeActiveEditor` api. This is similar to `onDidChangeActiveTextEditor` but is also fired when you change webviews. It replaces the old `onFocus` and `onBlur` events on the webview itself

- Adds an `onDispose` event ot webviews. This is fired when a webview is closed by the user

- Perist webview state when the editor group changes. This is enabled for all webviews, not just those with keep alive.

* Throw error when trying to access disposed webview

* Improving webview documentation

* Clean up dispose management

* Throw if we receive a bad handle

* Move more event handling to input

* Simplify input updating

* Remove extra container property

* Fixing md security alert button

* Remove extra update container call

* Restore syncing of preview to active editor

* Fixing posting to webview

* Debounce preview updates

* Remove previewUri

* Enable direct window.postMessage instead of window.parent.postMessage

* Fixing scroll position not preserved when updating previews

* Revert parent.postMessage change.

Old behavior was correct

* Properly hide webview container on tab switch

* Make sure we only handle scroll events for the correct document

* Don't try setting negative scroll

* Revert vs code whitespace change
2018-02-26 10:06:50 -08:00
Matt Bierner
e1f33fbb07 Rename ext host / main thread editor to textEditor
Rename to make it more clear that these APIs are for `vscode.TextEditor`
2018-02-15 15:32:16 -08:00
Alex Dima
54e7055c12 Rename IModel to ITextModel 2018-01-04 16:44:40 +02:00
Alex Dima
0721df783d Extract model types out of editorCommon.ts 2018-01-04 16:27:58 +02:00
Alex Dima
1ec2438d57 Remove usage of CustomMarshaller for MainThreadEditors (#40169) 2017-12-13 17:01:24 +01:00
Matt Bierner
d8e926be97 Mark most private static constants as private static readonly 2017-11-20 15:18:52 -08:00
Alex Dima
324650128e Add fast path for vscode.TextEditor.setDecorations 2017-10-16 22:48:45 +02:00
Johannes Rieken
229093ec9e debt - remove unused 'usesCommandLink' telemetry 2017-10-02 14:40:03 +02:00
kieferrm
08d8f0f9f6 indentation changes 2017-09-25 18:36:43 -07:00
kieferrm
fbb3e25987 omit endPoint where it defaults to none 2017-09-25 18:36:43 -07:00
kieferrm
a65363876a more GDPR classification 2017-09-25 18:36:43 -07:00
Johannes Rieken
0417a75e4f know decorations using command links v2, #29076 2017-08-23 12:23:39 +02:00
Johannes Rieken
eb4e09ba69 Revert "know decorations using command links, #29076"
This reverts commit 94c4b25a47.
2017-08-23 11:54:45 +02:00
Johannes Rieken
94c4b25a47 know decorations using command links, #29076 2017-08-23 11:50:58 +02:00
Ron Buckton
066a2bb141 Update Promise definition (#30268)
* Update definition of Promise in winjs.base.d.ts.

* Update to new Promise declaration

* Fix remaining errors.
2017-08-18 00:02:57 -07:00
Johannes Rieken
b8e8c435cc ignore dispose-errors, fixes #30578 2017-08-16 12:00:51 +02:00
Felix Becker
dbe0f89264 Always reject Promises with Error instances 2017-06-26 15:24:41 +02:00
Johannes Rieken
b548d2128d split things up into api/node and api/electron-browser 2017-05-12 11:24:22 +02:00
Alex Dima
974f8aca31 Fixes #20757: Detect overlapping ranges in the extension host, no need to call into renderer process to find out the edits are illegal 2017-04-27 12:48:58 +02:00
Benjamin Pasero
b34f17350f Un-allowed double quoted imports (for #25451) 2017-04-26 19:13:12 +02:00
Matt Bierner
6147b54439 Fix TS 2.3.1 Compiler Errors in VSCode src/workbench (#25249)
TS 2.3.1 introduced a breaking change by [switching to covariant types for callbacks](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#covariance-in-callback-parameters). This change tries to fix these compiler errors in the workbench codebase
2017-04-25 08:20:25 -07:00
Alex Dima
f3be941164 Move IRange out of editorCommon 2017-04-18 17:33:22 +03:00
Alex Dima
5aea732093 Move editor options out of editorCommon 2017-04-18 16:30:09 +03:00
Joao Moreno
acb29bf425 registerDiffInformationCommand instead of computeDiff 2017-03-24 15:22:43 +01:00
Johannes Rieken
c01a616062 debt - allow to somewhat work with a closed editor 2017-03-23 09:53:19 +01:00
Johannes Rieken
1239cebb70 Merge branch 'joh/editors' 2017-03-06 12:40:47 +01:00