You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,15 +9,17 @@
9
9
10
10
# TextFormation
11
11
12
-
TextFormation is simple rule system that can be used to implement typing completions and whitespace control. Think matching "}" with "{" and indenting.
12
+
TextFormation is simple rule system that can be used to implement typing completions and whitespace control.
13
+
14
+
Think matching typing "{", hitting return, and getting "}" with indenting.
13
15
14
16
- Text system agnostic
15
-
- Many pre-built filters for commmon language patterns
16
-
- Compatible with multi-cursor systems
17
-
-Support for multiple line-ending encodings
17
+
- Many pre-built filters for common language patterns
18
+
- Compatible with multiple cursors editing systems
19
+
-Flexible whitespace calculations
18
20
19
21
> [!WARNING]
20
-
> This library is undergoing some major changes. Not all functionality is currently implemented in the main branch yet.
22
+
> The main branch has undergone some major changes to support new capabilities. Not all indentation calculation features are available quite yet.
21
23
22
24
## Integration
23
25
@@ -29,14 +31,12 @@ dependencies: [
29
31
30
32
## Concept
31
33
32
-
TextFormation's core model is a `Filter`. Filters are typically set up once for a given language. From there, changes in the form of a `TextMutation` are fed in. The filter examines a `TextMutation`**before** it has been applied. Filters can be stateful, but if they return `MutationOutput`, it means it has processed the mutation and no futher action should be taken.
34
+
TextFormation's core model is a `Filter`. Filters are typically set up once for a given language. From there, changes in the form of a `TextMutation` are fed in. The filter examines a `TextMutation`**before** it has been applied. Filters can be stateful, but if they return `MutationOutput`, it means it has processed the mutation and no further action should be taken.
33
35
34
-
TextFormation is fully text system-agnostic and it models the text system using an abstraction based on types from [Rearrange](https://github.com/ChimeHQ/Rearrange).
36
+
TextFormation is fully text system-agnostic and it models the text system using an abstraction based on types from [Rearrange](https://github.com/ChimeHQ/Rearrange). This requires that you provide a `TextSystemInterface` implementation. This type is responsible for supporting the querying and mutation capabilities filters need, along with an abstraction for how text positions and ranges are represented.
35
37
36
38
## Filters
37
39
38
-
Using TextFormation requires that you provide a `TextSystemInterface` implementation. This type is responsible for supporting the querying and mutation capabilties filters need, along with an abstraction for how text positions and ranges are represented.
39
-
40
40
Careful filter ordering can produce some pretty powerful behaviors. Here's an example of a chain that produces typing completions that roughly matches what Xcode does for open/close curly braces:
Correctly indenting in the general case may require parsing. It also typically needs some understanding of the user's preferences. The included `TextualIndenter` type has a pattern-based system that can perform sufficiently in many situations.
71
71
72
-
It also includes pre-defined patterns for some languages:
72
+
It includes `basicPatterns` that work well for many languages. There are also some pre-defined patterns:
0 commit comments