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

Theme background #123

Merged
merged 3 commits into from
Jan 23, 2023
Merged

Theme background #123

merged 3 commits into from
Jan 23, 2023

Conversation

neil-ptr
Copy link
Contributor

@neil-ptr neil-ptr commented Jan 20, 2023

Description

Adds useThemeBackground to CodeEditTextView which dictates whether the background of CodeEditTextView is clear or uses the given theme background color

Related

@thecoolwinter thecoolwinter merged commit 58f7941 into CodeEditApp:main Jan 23, 2023
thecoolwinter pushed a commit that referenced this pull request Mar 16, 2023
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

1. Add 20 pixels of inset to the left of the ruler and 8 pixels of inset
to the right of the ruler. I tried to match it as close as possible to
Xcode.
2. Set the background color of the highlight ruler line to the same
color as the highlighted line in the textView.

### Related Issues

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

* closes #156
* closes #128

### 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 -->

<img width="765" alt="Screenshot 2023-03-16 at 19 05 59"
src="https://user-images.githubusercontent.com/82230675/225717006-40530a7b-7864-404b-8d14-5307f6f83bdb.png">


<!--- IMPORTANT: Fill out all required fields. Otherwise we might close
this PR temporarily -->
lukepistrol added a commit that referenced this pull request Mar 26, 2023
…ont and ruler Inset scale with text font size. (#170)

<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

This PR adds a customized SF Pro Font which aims to look like the Xcode
Digits font.
The ruler font and the ruler insets scale with the text font size. 

### Related Issues

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

* closes #58
* closes #157 

### 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 -->
PointSize 13:
Xcode left, CodeEdit Right:
<img width="73" alt="image"
src="https://user-images.githubusercontent.com/82230675/227798735-1041b4a0-7aa9-4e3e-8c73-a8993427e862.png">

PointSize 20:
Xcode left, CodeEdit Right:
<img width="162" alt="image"
src="https://user-images.githubusercontent.com/82230675/227799017-87c08fb7-bac5-4a63-8fb2-b0bf4b0f3f0b.png">



<!--- IMPORTANT: Fill out all required fields. Otherwise we might close
this PR temporarily -->

---------

Co-authored-by: Lukas Pistrol <[email protected]>
austincondiff pushed a commit that referenced this pull request Mar 28, 2023
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

> This is a near clone of #147, but git got messed up on that branch.
This PR improves that branch anyways.

This enables configuration of the behavior when the tab key is pressed.
Previously all tabs were converted to spaces and inserted `tabWidth`
spaces in place of the tab character. This PR clarifies that the
`tabWidth` parameter should be used for the *visual* width of tabs, and
adds an `indentOption` parameter that specifies how to handle inserting
tab characters.

Adds an `IndentOption` enum with two cases for this behavior:
- `spaces(count: Int)`
- `tab`

If `spaces(count: Int)` is specified, the editor will insert the given
number of spaces when the tab key is pressed, otherwise the tab
character will be kept.

### Related Issues

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

* #80 - Does not close, needs an additional PR for the tab width
setting.

### 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


https://user-images.githubusercontent.com/35942988/228014785-85a20e2e-0465-4767-9d53-b97b4df2e11e.mov
austincondiff pushed a commit that referenced this pull request Apr 4, 2023
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

This PR adds the tab stops implementation. It was previously thought to
not function as expected but after comparing to other editors this is
the correct implementation. Adding tab stops makes it so tabs stop at
intervals along the document, so a tab will not act like a space but
rather a break in the line until the next tab stop. Like so:
```
Raw:   |\t1\t2\t3
Visual:|----1---2---3

Raw:   |\tabc\t2\t3
Visual:|----abc-2---3
```

### Related Issues

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

* Closes #80  

### 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

Screen recording shows the width being updated in real time using a
placeholder preference, as well as editing a line with tabs showing the
tab stops go backwards only when needed.


https://user-images.githubusercontent.com/35942988/229870857-2cb2e40b-4c61-43ce-96c7-f79a8514cfbd.mov



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

<!--- IMPORTANT: Fill out all required fields. Otherwise we might close
this PR temporarily -->
matthijseikelenboom pushed a commit that referenced this pull request Apr 4, 2023
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

<!--- REQUIRED: Describe what changed in detail -->

This change adds all positive edits to the visible range. The assumption
is that any edits the user may make are going to be visible at some
point in time. If the cursor is not already on the page, it will be
scrolled to and if it extends beyond the viewport it will be scrolled to
be visible as well. In both of those cases the added range will be
overridden immediately due to the scroll. So this fixes the case where
characters are being inserted at the end of a file, but aren't being
scrolled to. This is apparent in the attached screen recordings.

Alternatives considered:
- **Re-calculating the visible set:** Decided against due to the extra
work that would need to be done potentially every keystroke to calculate
a new visible range.
- **Update the visible set only if the edit is actually visible:**
Decided against due to the reasons previously mentioned. Any edit will
eventually be included in the visible set if it is not already in it
when the edit occurs.

### Related Issues

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

* closes #142
* Maybe related to #162

### 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

Before fix. Edits applied to the end of the file are never sent to
tree-sitter for highlighting as they are out of the range of the visible
set. They are only updated when the document is scrolled and
`visibleSet` is recalculated.


https://user-images.githubusercontent.com/35942988/229874599-e2714b72-d51f-4748-89e1-b80ee51bddda.mov

After fix. Edits with positive deltas are always included in the
`visibleSet`.


https://user-images.githubusercontent.com/35942988/229875515-36e96921-71c0-48aa-a62c-75cbd91c52fb.mov


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

<!--- IMPORTANT: Fill out all required fields. Otherwise we might close
this PR temporarily -->
austincondiff pushed a commit that referenced this pull request May 10, 2023
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description
Fixes a bug found found by @cengelbart39 [on
discord](https://canary.discord.com/channels/951544472238444645/952640521812193411/1104143145765187644)
where a parser would consume ranges already consumed by injected
languages. This caused the injected ranges to be realized as plain text,
when they should have been kept as their injected language's highlights.

This should have been avoided by the call to `query.setRange(range)` on
line [43 in
TreeSitterClient+Highlight.swift](https://github.com/CodeEditApp/CodeEditTextView/blob/045bd359ef9c4addf2a5bf51e22ba660d69c5d10/Sources/CodeEditTextView/TreeSitter/TreeSitterClient%2BHighlight.swift#L44)
but it was found that for some reason in the case found by @cengelbart39
it just didn't work.

To fix, an additional check was added in `highlightsFromCursor` to only
take any ranges that have indices in the intersection of it's range and
the included range.

### Related Issues

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

* See discord link.

### 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

Before:


https://user-images.githubusercontent.com/35942988/236696171-d30dfd7b-8545-4396-8aa8-490ceac65551.mov

After:


https://user-images.githubusercontent.com/35942988/236697575-3f605c0d-3dda-45c2-8f69-0f41148f1c2d.mov
thecoolwinter added a commit that referenced this pull request Jul 11, 2023
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

Adds a minimum ruler width equal to 4 digits wide to reduce layout shift
while scrolling.

### Related Issues

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

* N/A, discussed a couple times in discord.

### 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

Previous:
<img width="356" alt="Screenshot 2023-07-11 at 12 28 26 PM"
src="https://github.com/CodeEditApp/CodeEditTextView/assets/35942988/469044fa-189f-41d8-83ca-367f2244fe82">

Now:
<img width="321" alt="Screenshot 2023-07-11 at 12 27 51 PM"
src="https://github.com/CodeEditApp/CodeEditTextView/assets/35942988/547dcdda-f50e-4be6-a065-7fef5b6e7cd7">
austincondiff pushed a commit that referenced this pull request Feb 3, 2024
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

Makes JSDocs highlight as comments. Because they're injected as a
different language they don't get captured normally. This is the only
language we have to handle this in so it's hard-coded in the
TreeSitterClient.

Also adds a quick check to prevent potential recursive cursor
notifications using SwiftUI.

### Related Issues

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

* [Discord
conversation](https://canary.discord.com/channels/951544472238444645/987416899816149024/1201620579590090853)

### 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

<img width="285" alt="Screenshot 2024-02-02 at 7 37 19 PM"
src="https://github.com/CodeEditApp/CodeEditSourceEditor/assets/35942988/f201e5ff-1bf9-4bb5-97fb-0914aa66246a">
thecoolwinter added a commit that referenced this pull request Feb 4, 2024
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

Finishes the required changes to make
[CodeEditTextView#14](CodeEditApp/CodeEditTextView#14)
work in CESE, once those changes are merged with a package update.

Removes the first responder acquisition when updating cursors, the text
view should handle focus state and does so correctly on the main branch.
Also fixes a small ordering bug with a check variable related to this
issue.

### Related Issues

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

* CodeEditTextView issue, no issues created here.

### 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

N/A
austincondiff pushed a commit that referenced this pull request May 20, 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. * #123) -->
<!--- If this PR resolves the issue please specify (e.g. * closes #123)
-->
<!--- If this PR addresses multiple issues, these issues must be related
to one other -->

* closes #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 -->
austincondiff pushed a commit that referenced this pull request Aug 23, 2024
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description
This PR lets you highlight multiple lines and comment them all out at
once.


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


### 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


https://github.com/user-attachments/assets/97ae52d5-0fb0-4b25-90e6-2bbc18769856

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

<!--- IMPORTANT: Fill out all required fields. Otherwise we might close
this PR temporarily -->
austincondiff pushed a commit that referenced this pull request Oct 12, 2024
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

<!--- REQUIRED: Describe what changed in detail -->
New Shortcuts:
- <kbd>tab</kbd> increases indention level 
- <kbd>⇧</kbd> <kbd>tab</kbd> decreases indentation level 
- <kbd>⌘</kbd> <kbd>]</kbd> increases indention level
- <kbd>⌘</kbd> <kbd>[</kbd> decreases indentation level

The keyboard shortcuts also work with multiple cursors.

**Blocker:**
~~1. The functions aren't connected to the editor's settings, meaning
the space count is hardcoded to 2 spaces for now.~~
~~2. In the current implementation, the user cannot use the Tab key as
expected.~~

### Related Issues


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

* closes #220 

### 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
- [x] I've added tests

### Screenshots

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

<!--- IMPORTANT: Fill out all required fields. Otherwise we might close
this PR temporarily -->

---------

Co-authored-by: Khan Winter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants