Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pulsar-edit/pulsar into updated-l…
Browse files Browse the repository at this point in the history
…atest-electron
  • Loading branch information
savetheclocktower committed Dec 1, 2024
2 parents caf9795 + ae3d51f commit 2f6407f
Show file tree
Hide file tree
Showing 13 changed files with 135 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ arm_linux_task:
memory: 8G
env:
USE_SYSTEM_FPM: 'true'
ROLLING_UPLOAD_TOKEN: ENCRYPTED[bda9bda0d9ca3ed72f8efdf33e09c0abe63f568db948b11e348f963dd532c08fdf91e54d7db549b97f763f284c4a96ec]
ROLLING_UPLOAD_TOKEN: ENCRYPTED[bc554e7208b73b37e2b776c70905b142a5023cea4a9b89e1370b8815adea18f8436e8b075e6cf1bcb62133d659b5d198]
prepare_script:
- apt-get update
- export DEBIAN_FRONTEND="noninteractive"
Expand Down Expand Up @@ -135,7 +135,7 @@ silicon_mac_task:
APPLEID: ENCRYPTED[549ce052bd5666dba5245f4180bf93b74ed206fe5e6e7c8f67a8596d3767c1f682b84e347b326ac318c62a07c8844a57]
APPLEID_PASSWORD: ENCRYPTED[774c3307fd3b62660ecf5beb8537a24498c76e8d90d7f28e5bc816742fd8954a34ffed13f9aa2d1faf66ce08b4496e6f]
TEAM_ID: ENCRYPTED[11f3fedfbaf4aff1859bf6c105f0437ace23d84f5420a2c1cea884fbfa43b115b7834a463516d50cb276d4c4d9128b49]
ROLLING_UPLOAD_TOKEN: ENCRYPTED[bda9bda0d9ca3ed72f8efdf33e09c0abe63f568db948b11e348f963dd532c08fdf91e54d7db549b97f763f284c4a96ec]
ROLLING_UPLOAD_TOKEN: ENCRYPTED[bc554e7208b73b37e2b776c70905b142a5023cea4a9b89e1370b8815adea18f8436e8b075e6cf1bcb62133d659b5d198]
prepare_script:
- brew update
- brew uninstall node@20
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@

## [Unreleased]

## 1.123.0

- Fixed SQL State Storage not loading when starting Pulsar from a self-contained binary like appImage, tar.gz, etc.
- [symbols-view] Allow project-wide symbol search to consider results from more than one provider.
- Tree-sitter fixes and enhancements for hyperlinks, C, and shell scripts.
- Restore use of `shell.moveItemToTrash` API in tree-view, for Electron 12 compatibility.

### Pulsar

- Tree-sitter rolling fixes, 1.123 edition [@savetheclocktower](https://github.com/pulsar-edit/pulsar/pull/1118)
- [symbols-view] Allow project-wide symbol searches to consider multiple providers [@savetheclocktower](github.com/pulsar-edit/pulsar/pull/1133)
- electron-builder: Fix race condition when preparing to copy binaries [@DeeDeeG](https://github.com/pulsar-edit/pulsar/pull/1137)
- [ci] Update GitHub Token in CirrusCI config [@confused-Techie](https://github.com/pulsar-edit/pulsar/pull/1134)
- Fixing requiring of better-sqlite3 [@mauricioszabo](github.com/pulsar-edit/pulsar/pull/1122)
- Revert removal of `shell.moveItemToTrash` [@savetheclocktower](https://github.com/pulsar-edit/pulsar/pull/1125)
- CI: Bump macOS runner images from macos-12 to macos-13 [@DeeDeeG](https://github.com/pulsar-edit/pulsar/pull/1120)

## 1.122.0

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pulsar",
"author": "Pulsar-Edit <admin@pulsar-edit.dev>",
"productName": "Pulsar",
"version": "1.122.0-dev",
"version": "1.123.0-dev",
"description": "A Community-led Hyper-Hackable Text Editor",
"branding": {
"id": "pulsar",
Expand Down
8 changes: 4 additions & 4 deletions packages/language-c/grammars/tree-sitter-cpp/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@
; ((identifier) @variable.other.readwrite.member.cpp
; (#match? @variable.other.readwrite.member.cpp "^(f|m)[A-Z]\\w*$"))

; The "foo" in `int &foo` with in a parameter list.
(parameter_declaration
declarator: (reference_declarator
(identifier) @variable.parameter.cpp))
; The "foo" in `const char *foo` within a parameter list.
; (Should work no matter how many pointers deep we are.)
(reference_declarator (identifier) @variable.parameter.cpp
(#is? test.descendantOfType "parameter_declaration"))


; KEYWORDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ parser: 'tree-sitter-hyperlink'

injectionRegex: 'hyperlink'
treeSitter:
parserSource: 'github:savetheclocktower/tree-sitter-hyperlink#04c3a667ba432236578ac99bbacd0412f88d6fac'
parserSource: 'github:savetheclocktower/tree-sitter-hyperlink#0704b3e5a72892495dd13b85a5064582414cb39a'
grammar: 'ts/tree-sitter-hyperlink.wasm'
highlightsQuery: 'ts/highlights.scm'
Binary file modified packages/language-hyperlink/grammars/ts/tree-sitter-hyperlink.wasm
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,15 @@
(binary_expression ["&&" "||"] @keyword.operator.logical.shell)

(pipeline "|" @keyword.operator.pipe.shell)
(expansion operator: "#" @keyword.operator.expansion.shell)

; Any expansion operator, including all `#`s and `%`s in the following examples:
;
; foo="${bar#*.}"
; foo="${bar##*.}"
; foo="${bar%*.}"
; foo="${bar%%*.}"
;
(expansion operator: _ @keyword.operator.expansion.shell)


; "*" @keyword.operator.glob.shell
Expand Down
6 changes: 5 additions & 1 deletion packages/symbols-view/lib/project-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ module.exports = class ProjectView extends SymbolsView {
// longer need the symbols we asked for.
let signal = this.abortController.signal;

let providers = await this.broker.select(meta);
// A user would probably expect this search to return symbols from all
// files in the project, regardless of their language. Instead of picking a
// “winning” provider as we usually do, we should instead consult _all_
// providers that consider themselves up to the task.
let providers = await this.broker.select(meta, { enforceExclusivity: false });
if (providers?.length === 0) {
console.warn('No providers found!');
return null;
Expand Down
11 changes: 9 additions & 2 deletions packages/symbols-view/lib/provider-broker.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ module.exports = class ProviderBroker {
* @returns {Promise<SymbolProvider[]>} A promise that resolves with a list
* of symbol providers.
*/
async select(meta) {
async select(meta, { enforceExclusivity = true } = {}) {
let shouldLog = Config.get('enableDebugLogging');
let exclusivesByScore = [];
let results = [];
Expand Down Expand Up @@ -210,7 +210,14 @@ module.exports = class ProviderBroker {
let { value: score } = outcome;
let name = provider.name ?? 'unknown';
let packageName = provider?.packageName ?? 'unknown';
let isExclusive = provider?.isExclusive ?? false;

// When `enforceExclusivity` is `false`, we'll treat all providers as
// non-exclusive, even the ones that indicate otherwise.
//
// It still falls on a provider to know whether to provide symbols or
// not. Any provider is free to inspect the metadata and return an empty
// set if it thinks it's inappropriate for its results to be considered.
let isExclusive = enforceExclusivity ? (provider?.isExclusive ?? false) : false;

if (shouldLog)
console.debug('Score for', provider.name, 'is:', score);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const { Point } = require('atom');

function last(arr) {
return arr[arr.length - 1];
}

const ICONS = [
'icon-package',
'icon-key',
'icon-gear',
'icon-tag',
null
];

module.exports = {
packageName: 'symbol-provider-dummy-second',
name: 'Dummy (Second)',
isExclusive: true,
canProvideSymbols() {
return true;
},
getSymbols(meta) {
let { editor, type } = meta;
let results = [];
if (type === 'file') {
let count = editor.getLineCount();
// Put a symbol on every third line.
for (let i = 0; i < count; i += 3) {
results.push({
position: new Point(i, 0),
name: `(Second) Symbol on Row ${i + 1}`,
icon: ICONS[(i / 3) % (ICONS.length + 1)]
});
}
} else if (type === 'project') {
let root = last(atom.project.getPaths());
let count = editor.getLineCount();
// Put a symbol on every third line.
for (let i = 0; i < count; i += 3) {
results.push({
position: new Point(i, 0),
name: `(Second) Symbol on Row ${i + 1}`,
directory: root,
file: 'other-file.js',
icon: ICONS[i % (ICONS.length + 1)]
});
}
}
return results;
}
};
22 changes: 22 additions & 0 deletions packages/symbols-view/spec/symbols-view-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const SymbolsView = require('../lib/symbols-view');
const { migrateOldConfigIfNeeded } = require('../lib/util');

const DummyProvider = require('./fixtures/providers/dummy-provider');
const SecondDummyProvider = require('./fixtures/providers/second-dummy-provider');
const AsyncDummyProvider = require('./fixtures/providers/async-provider');
const ProgressiveProjectProvider = require('./fixtures/providers/progressive-project-provider.js');
const QuicksortProvider = require('./fixtures/providers/quicksort-provider.js');
Expand Down Expand Up @@ -696,6 +697,27 @@ describe('SymbolsView', () => {
expect(symbolsView.element.querySelector('li:first-child .secondary-line')).toHaveText(`${relative}:13`);
});

it('includes results from all providers, even if they claim to be exclusive', async () => {
registerProvider(DummyProvider);
registerProvider(SecondDummyProvider);

await dispatchAndWaitForChoices('symbols-view:toggle-project-symbols');
symbolsView = atom.workspace.getModalPanels()[0].item;

expect(symbolsView.selectListView.refs.loadingMessage).toBeUndefined();
expect(document.body.contains(symbolsView.element)).toBe(true);
expect(symbolsView.element.querySelectorAll('li').length).toBe(10);

let root = atom.project.getPaths()[1];
let resolved = directory.resolve('other-file.js');
let relative = `${path.basename(root)}${resolved.replace(root, '')}`;

expect(symbolsView.element.querySelector('li:first-child .primary-line')).toHaveText('Symbol on Row 1');
expect(symbolsView.element.querySelector('li:first-child .secondary-line')).toHaveText(`${relative}:1`);
expect(symbolsView.element.querySelector('li:last-child .primary-line')).toHaveText('(Second) Symbol on Row 13');
expect(symbolsView.element.querySelector('li:last-child .secondary-line')).toHaveText(`${relative}:13`);
});

it('does not prefill the query field if `prefillSelectedText` is `false`', async () => {
atom.config.set('symbols-view.prefillSelectedText', false);
registerProvider(DummyProvider);
Expand Down
26 changes: 4 additions & 22 deletions packages/welcome/lib/changelog-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,16 @@ export default class ChangeLogView {
<p>Feel free to read our <a href="https://github.com/pulsar-edit/pulsar/blob/master/CHANGELOG.md">Full Change Log</a>.</p>
<ul>
<li>
Added a SQL State Storage alternative to IndexedDB (opt-in, off by default).
Fixed SQL State Storage not loading when starting Pulsar from a self-contained binary like appImage, tar.gz, etc.
</li>
<li>
Repackaged the AppImage so it uses our launcher script internally (supports more CLI/launch flags).
[symbols-view] Allow project-wide symbol search to consider results from more than one provider.
</li>
<li>
[language-php] Highlighted “null-safe” property access correctly.
Tree-sitter fixes and enhancements for hyperlinks, C, and shell scripts.
</li>
<li>
[language-c] Scoped template delimiters properly in C++.
</li>
<li>
[language-c] Consolidated common highlighting queries between the C and C++ grammars for more consistency in syntax highlighting.
</li>
<li>
Fixed incorrect behavior in certain scenarios for “Fold at Indent Level X” commands.
</li>
<li>
Fixed exception when resolving divided folds (e.g., <code>#ifdefs</code> in C/C++).
</li>
<li>
Avoided "length of null" error in autocomplete-plus for the PHP Tree-sitter grammar.
</li>
<li>
Preserved <code>/usr/bin/pulsar</code> and <code>/usr/bin/ppm</code> on RPM updates.
</li>
<li>
[tree-view] Moved to a more modern API for file removal in preparation for an Electron upgrade.
Restore use of <code>shell.moveItemToTrash</code> API in tree-view, for Electron 12 compatibility.
</li>
</ul>

Expand Down
15 changes: 12 additions & 3 deletions script/electron-builder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path')
const normalizePackageData = require('normalize-package-data');
const fs = require("fs/promises");
const {mkdirSync} = require("fs");
const generateMetadata = require('./generate-metadata-for-builder')
const macBundleDocumentTypes = require("./mac-bundle-document-types.js");

Expand Down Expand Up @@ -198,7 +199,8 @@ let options = {
},
},
"dmg": {
"sign": false
"sign": false,
"writeUpdateInfo": false
},
"win": {
"icon": icoIcon,
Expand Down Expand Up @@ -235,7 +237,8 @@ let options = {
// the AppID 'dev.pulsar-edit.pulsar'. If this value ever changes,
// A PR to GitHub Desktop must be made with the updated value
"include": "resources/win/installer.nsh",
"warningsAsErrors": false
"warningsAsErrors": false,
"differentialPackage": false
},
"extraMetadata": {
},
Expand Down Expand Up @@ -289,7 +292,13 @@ async function main() {
config: options
}).then((result) => {
console.log("Built binaries")
fs.mkdir('binaries').catch(() => "")
try {
mkdirSync('binaries', {recursive: true})
} catch (err) {
console.warn("Warning: error encountered when making the 'binaries' dir.")
console.warn("(HINT: If the 'binaries' folder already exists, then this error message is probably fine to ignore!)")
console.warn(err)
}
Promise.all(result.map(r => fs.copyFile(r, path.join('binaries', path.basename(r)))))
}).catch((error) => {
console.error("Error building binaries")
Expand Down

0 comments on commit 2f6407f

Please sign in to comment.