Skip to content

Commit 768882f

Browse files
Update docs to: Add indentation configuration from modes (#136)
1 parent cd2c39b commit 768882f

File tree

2 files changed

+44
-25
lines changed

2 files changed

+44
-25
lines changed

docs/menus.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -201,22 +201,6 @@ Opens a new file and moves the selected lines to that file.
201201
Sends a completion query (request), editor will send request when you stop typing as default, but
202202
you can do this manually with this option.
203203

204-
### Indention (Submenu)
205-
It puts the actions related to indention in a group.
206-
207-
#### Auto Indent
208-
Will automaticly indent whole file content.
209-
210-
!!! Note
211-
212-
Some modes don’t support Auto Indent; this option is enabled only for supported modes.
213-
214-
#### Convert Indent To Spaces
215-
Converts indention of currently selected line(s) to spaces and sets indention mode to spaces.
216-
217-
#### Convert Indent To Tabs
218-
Converts indention of currently selected line(s) to tabs and sets indention mode to tabs.
219-
220204
### Convert Case (Submenu)
221205
Provides options to convert selected text case, these options are simple, so we will not explain
222206
them here.
@@ -255,22 +239,46 @@ command name.
255239
This menu includes commands and actions related to formatting file content.
256240

257241
### Auto Format
258-
Will automaticly format whole file content.
242+
Will automatically format whole file content.
259243

260244
!!! Note
261245

262246
Some modes don’t support Auto Format; this option is enabled only for supported modes.
263247

264-
### Auto Indention
265-
When enabled, editor will try to calculate indention level when you add new line; Otherwise, will
266-
apply last line indention level for new line.
248+
### Indentation (Submenu)
249+
It puts the actions related to indentation in a group.
250+
251+
#### Auto Indent
252+
Will automaticly indent whole file content.
253+
254+
!!! Note
255+
256+
Some modes don’t support Auto Indent; this option is enabled only for supported modes.
257+
258+
#### Convert Indent To Spaces
259+
Converts indentation of currently selected line(s) to spaces and sets indentation mode to spaces.
260+
261+
#### Convert Indent To Tabs
262+
Converts indentation of currently selected line(s) to tabs and sets indentation mode to tabs.
263+
264+
#### Remove All Indents
265+
Removes all indentation and white spaces in both side of all lines.
266+
267+
#### Auto Indent New Lines
268+
When enabled, editor will try to calculate indentation level when you add new line; Otherwise, will
269+
apply last line indentation level for new line.
267270

268271
!!! Note
269272

270273
This feature is experimental and may behave unexpectedly.
271274

272-
### Remove All Indents
273-
Removes all indention and white spaces in both side of all lines.
275+
#### Lock Indentation Settings
276+
When enabled, protects indentation settings from changing, this change can come from *Indentation Settings*
277+
menu in editor bottom bar, mode-changing actions, etc.
278+
279+
#### Reset To Mode Indentation Settings
280+
Resets current mode's indentation settings to defined settings by mode developer. See [here](modes.md#mode-features)
281+
for more information about mode-driven indentation settings.
274282

275283
### Continue Placeholder Completion
276284
Returns you to Placeholder completion mode (when current file has any placeholder).

docs/modes.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ features of a mode depends on its developers:
3434

3535
We provide auto format and auto indent options separately, you can run these options to clean your files with modes'
3636
power. You can use these features from command palette, menus, or with shortcuts; These features are available in
37-
`Edit > Indention > Auto Indent` and `Format > Auto Format`, to see shortcuts, type `Auto Indent` or `Auto Format`
37+
`Format > Indentation > Auto Indent` and `Format > Auto Format`, to see shortcuts, type `Auto Indent` or `Auto Format`
3838
in command palette.
3939

4040
- **Initialization Lifecycle**
@@ -63,6 +63,18 @@ features of a mode depends on its developers:
6363
problems in **Problems Panel** in bottom of editor, in this panel all error and warnings provided by mode will show
6464
, and you can navigate between them by clicking on an item.
6565

66+
- **Indentation Settings** _optional_
67+
68+
After release of TFM API v2.2 (Text Forge v0.2), modes can provide indentation settings, so you can use multiple modes and be
69+
sure about automatic setting indentation options when you change mode. For example, in YAML indentation must be with spaces,
70+
bug in GDScript tabs are recommended, so a YAML mode can provide 2 spaces as indentation and a GDScript mode can provide
71+
single tab with 4 width as indentation and you haven't need to change indentation type and size each time you open a new file.
72+
73+
To customize this feature for each mode, you can use **Indentation Settings** menu in bottom right corner of editor
74+
(a button with a text like `Tabs (4)`), you can open a file with target mode and then use this button to set custom settings,
75+
Also you can use `Format > Indentation > Reset To Mode Indentation Settings` to restore original settings. If you want disable
76+
this feature (and use editor's indentation settings for all files) you can enable `Format > Indentation > Lock Indentation Settings`.
77+
6678
!!! Note
6779

6880
A lot of above features were added in TFM API v2.0, you can read more about this API [here](mode_development.md#text-forge-mode-api).
@@ -81,8 +93,7 @@ features of a mode depends on its developers:
8193

8294
!!! Note
8395

84-
Auto Format and Auto Indent are triggerable actions, there is an **Auto Indention** toggleable feature in `Format`
85-
menu that will change indention automatically when you create new line.
96+
Auto Format and Auto Indent are triggerable actions, there is an **Auto Indent New Lines** toggleable feature in `Format > Indentation` menu that will change indentation automatically when you create new line.
8697

8798
## Mode Kits
8899

0 commit comments

Comments
 (0)