CodeEditApp / CodeEditSourceEditor

A code editor view written in Swift powered by tree-sitter.
https://codeeditapp.github.io/CodeEditSourceEditor/documentation/codeeditsourceeditor
MIT License
504 stars 74 forks source link

Fixed some performance issues #182

Closed Wouter01 closed 1 year ago

Wouter01 commented 1 year ago

Description

This PR fixes an issue where the view would be reloaded too often. This happened because updateNSViewController is called too often. This mostly happens because of a change in the environment, which gets passed to the NSViewControllerRepresentable in the context variable.

Manual diffing is applied to check if any variables that matter have changed. If not, nothing is updated.

The initializer has also changed, a few variables are now just values instead of bindings. These don't have to be bindings, as the textview won't update variables.

Related Issues

https://github.com/CodeEditApp/CodeEdit/issues/1247

Checklist

Screenshots