Merge branch 'master' into remove-nslog

This commit is contained in:
Maurício Szabo 2023-04-18 12:35:59 -03:00 committed by GitHub
commit 1b4ed19b1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 420 additions and 19 deletions

134
.github/renovate.json vendored
View File

@ -1,20 +1,138 @@
{
"schedule": ["every weekend"],
"extends": [ "config:base", ":dependencyDashboardApproval"],
"constraints": {
"node": "< 16"
},
"labels": ["dependencies"],
"separateMajorMinor": "false",
"packageRules": [
{
"description": "Group all DevDependencies for the Core Editor",
"matchDepTypes": ["devDependencies"],
"matchUpdateTypes": ["major", "minor", "patch", "pin", "digest", "lockFileMaintenance", "rollback", "bump"],
"groupName": "devDependencies",
"semanticCommitType": "chore",
"automerge": true
"groupName": "Core DevDependencies",
"matchPaths": ["package.json"]
},
{
"description": "Group all Dependencies for the Core Editor",
"matchDepTypes": ["dependencies"],
"matchUpdateTypes": ["major", "minor", "patch", "pin", "digest", "lockFileMaintenance", "rollback", "bump"],
"groupName": "dependencies",
"semanticCommitType": "fix"
"groupName": "Core Dependencies",
"matchPaths": ["package.json"]
},
{
"description": "Group all of our Syntax Themes and UI Themes",
"groupName": "Core Syntax & UI Themes",
"matchPaths": [
"packages/*-syntax/**", "packages/*-ui/**", "packages/*-theme/**"
]
},
{
"description": "Group all of our Languages",
"groupName": "Core Languages",
"matchPaths": [
"packages/language-*/**"
]
},
{
"matchPaths": [ "packages/about/**" ], "groupName": "about package"
},
{
"matchPaths": [ "packages/archive-view/**" ], "groupName": "archive-view package"
},
{
"matchPaths": [ "packages/autocomplete-css/**" ], "groupName": "autocomplete-css package"
},
{
"matchPaths": [ "packages/autocomplete-html/**" ], "groupName": "autocomplete-html package"
},
{
"matchPaths": [ "packages/autocomplete-plus/**" ], "groupName": "autocomplete-plus package"
},
{
"matchPaths": [ "packages/autocomplete-snippets/**" ], "groupName": "autocomplete-snippets package"
},
{
"matchPaths": [ "packages/autoflow/**" ], "groupName": "autoflow package"
},
{
"matchPaths": [ "packages/background-tips/**" ], "groupName": "background-tips package"
},
{
"matchPaths": [ "packages/bookmarks/**" ], "groupName": "bookmarks package"
},
{
"matchPaths": [ "packages/bracket-matcher/**" ], "groupName": "bracket-matcher package"
},
{
"matchPaths": [ "packages/command-palette/**" ], "groupName": "command-palette package"
},
{
"matchPaths": [ "packages/dalek/**" ], "groupName": "dalek package"
},
{
"matchPaths": [ "packages/deprecation-cop/**" ], "groupName": "deprecation-cop package"
},
{
"matchPaths": [ "packages/dev-live-reload/**" ], "groupName": "dev-live-reload package"
},
{
"matchPaths": [ "packages/encoding-selector/**" ], "groupName": "encoding-selector package"
},
{
"matchPaths": [ "packages/exception-reporting/**" ], "groupName": "exception-reporting package"
},
{
"matchPaths": [ "packages/git-diff/**" ], "groupName": "git-diff package"
},
{
"matchPaths": [ "packages/go-to-line/**" ], "groupName": "go-to-line package"
},
{
"matchPaths": [ "packages/grammar-selector/**" ], "groupName": "grammar-selector package"
},
{
"matchPaths": [ "packages/image-view/**" ], "groupName": "image-view package"
},
{
"matchPaths": [ "packages/incompatible-packages/**" ], "groupName": "incompatible-packages package"
},
{
"matchPaths": [ "packages/line-ending-selector/**" ], "groupName": "line-ending-selector package"
},
{
"matchPaths": [ "packages/link/**" ], "groupName": "link package"
},
{
"matchPaths": [ "packages/markdown-preview/**" ], "groupName": "markdown-preview package"
},
{
"matchPaths": [ "packages/open-on-github/**" ], "groupName": "open-on-github package"
},
{
"matchPaths": [ "packages/package-generator/**" ], "groupName": "package-generator package"
},
{
"matchPaths": [ "packages/settings-view/**" ], "groupName": "settings-view package"
},
{
"matchPaths": [ "packages/status-bar/**" ], "groupName": "status-bar package"
},
{
"matchPaths": [ "packages/styleguide/**" ], "groupName": "styleguide package"
},
{
"matchPaths": [ "packages/tabs/**" ], "groupName": "tabs package"
},
{
"matchPaths": [ "packages/update-package-dependencies/**" ], "groupName": "update-package-dependencies package"
},
{
"matchPaths": [ "packages/welcome/**" ], "groupName": "welcome package"
},
{
"matchPaths": [ "packages/whitespace/**" ], "groupName": "whitespace package"
},
{
"matchPaths": [ "packages/wrap-guide/**" ], "groupName": "wrap-guide package"
}
]
}

View File

@ -7,6 +7,7 @@
## [Unreleased]
- Removed `nslog` dependency
- Fixed an error where the GitHub package tried to interact with a diff view after it was closed
## 1.104.0

View File

@ -0,0 +1,79 @@
---
# These are optional elements. Feel free to remove any of them.
status: {proposed | rejected | accepted | deprecated | … | superseded by ADR-0005 <0005-example.md>}
date: {YYYY-MM-DD when the decision was last updated}
deciders: {list everyone involved in the decision}
consulted: {list everyone whose opinions are sought (typically subject-matter experts); and with whom there is a two-way communication}
informed: {list everyone who is kept up-to-date on progress; and with whom there is a one-way communication}
---
# {short title of solved problem and solution}
## Context and Problem Statement
{Describe the context and problem statement, e.g., in free form using two to three sentences or in the form of an illustrative story.
You may want to articulate the problem in form of a question and add links to collaboration boards or issue management systems.}
<!-- This is an optional element. Feel free to remove. -->
## Decision Drivers
* {decision driver 1, e.g., a force, facing concern, …}
* {decision driver 2, e.g., a force, facing concern, …}
* … <!-- numbers of drivers can vary -->
## Considered Options
* {title of option 1}
* {title of option 2}
* {title of option 3}
* … <!-- numbers of options can vary -->
## Decision Outcome
Chosen option: "{title of option 1}", because
{justification. e.g., only option, which meets k.o. criterion decision driver | which resolves force {force} | … | comes out best (see below)}.
<!-- This is an optional element. Feel free to remove. -->
### Consequences
* Good, because {positive consequence, e.g., improvement of one or more desired qualities, …}
* Bad, because {negative consequence, e.g., compromising one or more desired qualities, …}
* … <!-- numbers of consequences can vary -->
<!-- This is an optional element. Feel free to remove. -->
## Validation
{describe how the implementation of/compliance with the ADR is validated. E.g., by a review or an ArchUnit test}
<!-- This is an optional element. Feel free to remove. -->
## Pros and Cons of the Options
### {title of option 1}
<!-- This is an optional element. Feel free to remove. -->
{example | description | pointer to more information | …}
* Good, because {argument a}
* Good, because {argument b}
<!-- use "neutral" if the given argument weights neither for good nor bad -->
* Neutral, because {argument c}
* Bad, because {argument d}
* … <!-- numbers of pros and cons can vary -->
### {title of other option}
{example | description | pointer to more information | …}
* Good, because {argument a}
* Good, because {argument b}
* Neutral, because {argument c}
* Bad, because {argument d}
* …
<!-- This is an optional element. Feel free to remove. -->
## More Information
{You might want to provide additional evidence/confidence for the decision outcome here and/or
document the team agreement on the decision and/or
define when and how this decision should be realized and if/when it should be re-visited and/or
how the decision is validated.
Links to other decisions and resources might appear here as well.}

View File

@ -0,0 +1,48 @@
---
status: accepted
date: 2022-08-01
---
# Removal of the old build scripts, V8 Snapshots, and migration to `yarn`
## Build scripts on Atom
It was _really difficult_ to understand the old build scripts. They basically
transpiled the old code and copied some dependencies on a directory called
`app`; then, some dependencies were installed, some other steps were run, like
creating some manifests and metadata; finally, this transpiled code was passed
through another script that basically generated a `mksnapshot` script command,
and everything was _manually packaged_ into an ASAR file.
The problems: the script was too big, it depended on `npm` < 7.0, it used to
fail constantly (needing multiple "clean" commands), it took too much time, and
basically the "snapshots" depended on the source file _structure_ on the disk -
if we decided to rename some file, or move some `require`s around, the script
would break; also, some of the dependencies of that script were also made
in-house, making for new work to keep in Pulsar
## Decision Drivers
* Easier to install dependencies
* Easier to build binaries, in a way that can work in the first run instead
of multiple retries
* Make it easier to build and start hacking the editor
* Faster to build and hack, specially after bumping dependencies
## Considered Options
* Rewrite the scripts
* Remove the scripts completely and migrate to electron-build
## Decision Outcome
Chosen option: "Remove the scripts". It makes things easier because we don't
need to keep any in-house packaging of Electron, ASAR creation, and
RPM/DEB/AppImage generation for Linux, or binaries for Mac / Windows.
### Consequences
* Faster editor bootstrap, and easier to bump dependencies, specially Electron
* The editor is _way slower_ to load
* We had some bugs because we are not using V8 Snapshots anymore - basically,
with V8 Snapshots, the global object `atom` was present where it wasn't supposed
to

View File

@ -0,0 +1,44 @@
---
status: accepted
---
# Removal of experimental watchers on Pulsar
## Removal of @atom/watcher and others
Atom had four different ways of watching for filesystem changes. Two used an
in-house library called `@atom/watcher` - one for "polling" and other for
"experimental". It also had a different library to watch files for changes that
basically used the Tree-View package's watch mechanism
## Decision Drivers
* We don't know what "experimental watcher" means, and we have no way of knowing
* We don't want to support another "in-house" library to watch files, specially
considering that it's a binary library
* We know that tree-view _can use_ Pulsar's watcher mechanism to watch files,
meaning we enter somekind of weird loop
## Considered Options
* Use `nsfw` only
* Use `chokidar` only
## Decision Outcome
Use only `nsfw` library to watch for changes, and use the community version of
that library. Make the config for "watch" in Pulsar reflect that we only have
`nsfw` as an option (Native operating system APIs).
## Validation
Files are still being watched. Config failed to watch, but that's because of a
different issue - see ADR 001
## More Information
We still have another "watch" library called Pathwatcher. It is used by
TextBuffer, atom-keymap and tree-view. It may be possible to remove this library
to use only Pulsar's watch mechanism (it is available under the public API) so
every code will basically use the public API and they will all respect the
choice of what Pulsar defined, if we decide to introduce new file watcher
libraries in the future

View File

@ -0,0 +1,22 @@
---
status: rejected
---
# Make a compatibility layer on Pulsar's "pathwatcher"
## Remove the binary dependency on "pathwatcher" and a compatibility layer to use Pulsar's public API
The idea was to keep 100% API compatibility with Pathwatcher using Pulsar's public API (using `require('atom').watchPath` code). The experiment lives on [Pulsar
Pathwatcher](https://github.com/pulsar-edit/pulsar-pathwatcher) repository
## Decision Drivers
* Avoid another watch library
* Avoid another binary dependency
## Decision Outcome
Because of the cyclic dependency between TextBuffer and Pulsar, together with
the "exports" library and other issues, this experiment didn't go far. Some
infinite loops happened, sometimes the renderer process crashed, and sometimes
other weird issues appeared depending on the order things got loaded, so
this will probably be revisited in the future, if at all.

View File

@ -0,0 +1,87 @@
---
status: accepted
date: 2023-03-28
deciders: '@mauricioszabo, @confused-Techie, @savetheclocktower'
---
# Use a different Oniguruma implementation for TextMate grammars
## Current version of Oniguruma is in-house and crashes with Electron >= 21
To tokenize TextMate grammars, Pulsar uses a NPM binary library called
Oniguruma. Unfortunately, while we could make the native library work on
Electron versions 14 up to 20, when upgrading to Electron 21 it breaks because
of the new V8 Memory Model (sandboxed pointers).
## Considered Options
* Migrate to a pure-JS version of Oniguruma
* Migrate to [WASM Oniguruma](https://github.com/rebornix/wasm-oniguruma)
* Migrate to [VSCode Oniguruma](https://github.com/microsoft/vscode-oniguruma/)
* Migrate **all tokenization** to [VSCode Textmate](https://github.com/microsoft/vscode-textmate)
## Decision Outcome
Chosen option: "Migrate fo VSCode Oniguruma", because the pure JS version we found was not up-to-date with Oniguruma and could not parse most of the Regexp that our grammars need; second, WASM Oniguruma didn't see any update in the last 6 years, so we end up with vscode-oniguruma.
We basically duplicated the
[first-mate](https://github.com/pulsar-edit/first-mate/) repository and created
[second-mate](https://github.com/pulsar-edit/second-mate/), that uses the new
VSCode oniguruma version
## Pros and Cons of the Options
### Bump to Electron 23
It was confirmed that new vscode-oniguruma works with Electron 23.
### Faster
This is maybe counter-intuitive, but for some reason, the tokenizer got faster
when we migrated to vscode-oniguruma (by about 50% in some cases). We had also
lower deviation - the slowest case and the fastest one are now closer in time
### macOS problems
This broke Silicon macOS builds because if we use WASM, we need to add [Allow
JIT entitlement to the plist
file](https://github.com/pulsar-edit/pulsar/pull/454). We solved this, but with
this entitlement, Intel macOS builds also got slower ([Electron issue](https://github.com/electron/electron/issues/26143))
### Memory leaks
We found out that in some situations, we could have memory leaks - basically,
WASM doesn't have garbage collection like Node, so every time we created new
`OnigScanner` objects (discarding the old ones) that caused a new memory
allocation without any deallocation of the old memory.
To mitigate this, we basically implemented a cache of `OnigScanner`s - when
someone instantiates this class, it'll first see if a previous version was
instantiated, and if so, it'll reuse the same object. This doesn't _actually
solve_ the memory leak, but makes it controllable - TextMate grammars do not use
too many regular expressions, so everytime one opens Pulsar, even if the user
have multiple TextMate grammars only it'll only leak a couple kilobytes of
memory, so it's considered a non-issue for now.
## Usage of VSCode TextMate
VSCode TextMate is a library that basically highlights all code in VSCode. One
idea was to migrate away completely from `first-mate` and use this library as
the tokenizer. Unfortunately, `first-mate` is actually _more correct_ than
VSCode's implementation - for example, Pulsar is able to higlight XML namespaces
on attributes, like for example `<e foo:bar="attr">` (the `foo` gets
highlighted)
## Second-Mate, and VSCode-Oniguruma patches
VSCode-Oniguruma works a little bit differently than Atom's version. On VSCode's
version, when it doesn't find a match (length=0 on the result) VSCode's version
return a meaningless value on `start` and `end`, whereas Atom's return the
latest `end` from the previous match. We had to normalize this on Second-Mate.
Also, Atom's version of Oniguruma had an object called `OnigRegExp` that the new
library doesn't have. The only usage of that object was a method called `test` -
fortunatelly, this translates 100% do using `OnigScanner#findNextMatchSync`, so
we moved all usages to this new API - meaning, `second-mate` is 90% compatible
with `first-mate`, with the exception of the `firstLineRegex` and
`contentsRegex`, that now return an object of `OnigScanner` instead of
`OnigRegExp`.

View File

@ -162,7 +162,7 @@
"timecop": "file:./packages/timecop",
"tree-sitter": "0.20.0",
"tree-view": "https://codeload.github.com/atom/tree-view/legacy.tar.gz/refs/tags/v0.229.1",
"typescript-simple": "8.0.6",
"typescript-simple": "github:pulsar-edit/typescript-simple#ccb03e558217030e8f261339281f1d69147934f7",
"underscore-plus": "^1.7.0",
"update-package-dependencies": "file:./packages/update-package-dependencies",
"vscode-ripgrep": "1.9.0",

View File

@ -225,7 +225,7 @@ export default class GitDiffView {
if (this.buffer.getLength() < MAX_BUFFER_LENGTH_TO_DIFF) {
// Before we redraw the diffs, tear down the old markers.
if (this.diffs)
for (const diff of this.diffs) this.markers.get(diff).destroy();
for (const diff of this.diffs) this.markers.get(diff)?.destroy();
this.markers.clear();
@ -258,6 +258,9 @@ export default class GitDiffView {
}
markRange(startRow, endRow, klass) {
if (this.editor.getBuffer().isDestroyed())
return;
const marker = this.editor.markBufferRange([[startRow, 0], [endRow, 0]], {
invalidate: 'never'
});

View File

@ -9560,17 +9560,16 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==
typescript-simple@8.0.6:
version "8.0.6"
resolved "https://registry.yarnpkg.com/typescript-simple/-/typescript-simple-8.0.6.tgz#567143bc6882012c045a60efc38a239a986f1af8"
integrity sha512-BZp2NFHLPTcT/lklpgCDkbPt5CJQE4Lwh9dPzJ01Qsi8FQPdLQJvHCpophpQmaBuVKlxlAeH+AkyNHPdcAFmLA==
"typescript-simple@github:pulsar-edit/typescript-simple#ccb03e558217030e8f261339281f1d69147934f7":
version "9.0.0"
resolved "https://codeload.github.com/pulsar-edit/typescript-simple/tar.gz/ccb03e558217030e8f261339281f1d69147934f7"
dependencies:
typescript "^2.2.1"
typescript "^5.0.3"
typescript@^2.2.1:
version "2.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
integrity sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==
typescript@^5.0.3:
version "5.0.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.3.tgz#fe976f0c826a88d0a382007681cbb2da44afdedf"
integrity sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==
typical@^2.4.2, typical@^2.6.0, typical@^2.6.1:
version "2.6.1"