Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Auto close brackets #244

Closed
jenslys opened this issue Mar 25, 2022 · 0 comments
Closed

✨ Auto close brackets #244

jenslys opened this issue Mar 25, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@jenslys
Copy link

jenslys commented Mar 25, 2022

Option to enable whether the editor should automatically close brackets after the user adds an opening bracket.

Preview (YouTube)

Close for the following:

''
""
()
[]
{}
@jenslys jenslys added the enhancement New feature or request label Mar 25, 2022
@austincondiff austincondiff changed the title [FEAT] - Auto close brackets ✨ Auto close brackets Mar 31, 2022
@austincondiff austincondiff moved this from 🆕 New to 🏁 Complete in CodeEdit Project Feb 14, 2023
xinix909 pushed a commit to xinix909/CodeTransfer that referenced this issue Sep 7, 2024
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

<!--- REQUIRED: Describe what changed in detail -->
Tags in HTML, JS, TS, JSX, and TSX are now autocompleted. When you type
`<div>` for example, the closing tag `</div>` will be autocompleted. If
you press enter, you will be put on a new line in between the opening
and closing and that new line will be indented. All tag attributes are
ignored in the closing tag.

### Related Issues


<!--- REQUIRED: Tag all related issues (e.g. * CodeEditApp#123) -->
<!--- If this PR resolves the issue please specify (e.g. * closes CodeEditApp#123)
-->
<!--- If this PR addresses multiple issues, these issues must be related
to one other -->

* closes CodeEditApp#244

### Checklist

<!--- Add things that are not yet implemented above -->

- [x] I read and understood the [contributing
guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md)
as well as the [code of
conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code

### Screenshots

<!--- REQUIRED: if issue is UI related -->


https://github.com/CodeEditApp/CodeEditSourceEditor/assets/118622417/cf9ffe27-7592-49d5-bee8-edacdd6ab5f4


<!--- IMPORTANT: Fill out all required fields. Otherwise we might close
this PR temporarily -->
xinix909 pushed a commit to xinix909/CodeTransfer that referenced this issue Sep 7, 2024
### Description

Fixes a few bugs with CodeEditApp#247 and converts it to use tree-sitter rather
than a regex-based implementation. This should be faster on larger
documents and makes it more robust to edge cases in tag regexes. This
also handles newlines correctly, as the old PR caused the editor to no
longer be able to delete newlines

Also fixes a small bug in the `TreeSitterClient` that caused *every*
query to be dispatched to main asynchronously. This was the cause for a
few visual oddities like flashing colors when changing themes. This also
improves highlighting while scrolling fast as most highlights are
processed synchronously.

- Removes extensions on `NewlineProcessingFilter`
- Cleans up `TagFilter`
  - Moves all newline processing to the one filter
- Use tree-sitter for tag completion, supporting the following
languages: HTML, JSX, TSX
- Adds a few methods to `TreeSitterClient` for synchronously querying
the tree sitter tree.
- Adds a new `TreeSitterClientExecutor` class that the client uses to
execute operations safely asynchronously and synchronously.
- This is extremely useful for testing, as it allows the tests to force
all operations to happen synchronously.
- Adds a check to `dispatchMain` to see if the thread is already the
main thread (meaning no async dispatch)

### Related Issues

* CodeEditApp#244 
* Discussion on discord
[Here](https://discord.com/channels/951544472238444645/1242238782653075537)

### Checklist

- [x] I read and understood the [contributing
guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md)
as well as the [code of
conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code

### Screenshots


https://github.com/CodeEditApp/CodeEditSourceEditor/assets/35942988/8fc559a4-15c9-4b4e-a3aa-57c86c57f7c9


https://github.com/CodeEditApp/CodeEditSourceEditor/assets/35942988/a209b40f-7aa3-4105-aa37-5608e8b4bcdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🏁 Complete
Development

No branches or pull requests

2 participants