Skip to content

feat: Added ORGMODE parser #1369

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

Merged
merged 4 commits into from
Jun 9, 2025
Merged

Conversation

eloycoto
Copy link
Contributor

@eloycoto eloycoto commented Jun 4, 2025

I heavilly use ORGMODE[0] for my notes, and I also love harper. This PR add the parser for ORGMODE, I also add support to haper-ls and harper-cli.

I know that maybe it's not complete at 100%, but I'm going to work over needed changes.

0: https://orgmode.org/

How Has This Been Tested?

cargo run --bin harper-cli -- lint /tmp/example.org

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes

@eloycoto eloycoto changed the title feat: Added ORGMODE parser WIP: feat: Added ORGMODE parser Jun 4, 2025
I heavilly use ORGMODE[0] for my notes, and I also love harper. This PR
add the parser for ORGMODE, I also add support to haper-ls and harper-cli.

I know that maybe it's not complete at 100%, but I'm going to work over
needed changes.

0: https://orgmode.org/

Signed-off-by: Eloy Coto <[email protected]>
@eloycoto eloycoto changed the title WIP: feat: Added ORGMODE parser feat: Added ORGMODE parser Jun 5, 2025
@eloycoto
Copy link
Contributor Author

eloycoto commented Jun 5, 2025

@elijah-potter could you tell me if this is something interesting for you and if it is ok to merge after review?

@elijah-potter elijah-potter requested a review from grantlemons June 5, 2025 14:53
Copy link
Collaborator

@elijah-potter elijah-potter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great work. I'm glad to see Org mode finally coming to Harper!

I would love to include this in the next release, but want a bit more assurance to its stability. Could we get a few more tests?

use super::{Parser, PlainEnglish};
use crate::{Span, Token, TokenKind};

/// A parser that wraps the [`PlainEnglish`] parser that allows one to parse
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An initial look appears solid to me. I appreciate the test coverage you have so far, but would love to see even more end-to-end tests. Would it be possible to toss some in harper-core/tests/test_sources/? You might need to modify the macro in harper-core/tests/run_tests.rs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense, I would create a file, I will use this one as default:
https://github.com/nvim-orgmode/orgmode/blob/32ef9e95f43a6e951fb931b438372546a4f0c524/docs/index.org

And I'll update the macro (Looks ok ish)

Copy link
Collaborator

@grantlemons grantlemons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like your code all operates around lines, but you are always just passing around the entire source. You might want to rework your functions to accept lines, and then loop through the lines (split by newline) in your parse function.

@eloycoto eloycoto changed the title feat: Added ORGMODE parser WIP: feat: Added ORGMODE parser Jun 7, 2025
@eloycoto eloycoto force-pushed the master branch 2 times, most recently from e9336d1 to 3506323 Compare June 7, 2025 10:55
Signed-off-by: Eloy Coto <[email protected]>
@eloycoto eloycoto changed the title WIP: feat: Added ORGMODE parser feat: Added ORGMODE parser Jun 8, 2025
@elijah-potter
Copy link
Collaborator

I have opened it up on my editor. From my limited understanding of orgmode, it looks good. If there are further issues, can we ping you as a resident expert on orgmode?

@eloycoto
Copy link
Contributor Author

eloycoto commented Jun 9, 2025

I have opened it up on my editor. From my limited understanding of orgmode, it looks good. If there are further issues, can we ping you as a resident expert on orgmode?

If I'm still alive by them, yes! I'm happy to check issues if happens :-)

@elijah-potter elijah-potter enabled auto-merge June 9, 2025 21:47
@elijah-potter elijah-potter added this pull request to the merge queue Jun 9, 2025
Merged via the queue into Automattic:master with commit 55f5e8b Jun 9, 2025
23 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jun 13, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [Automattic/harper/harper-ls](https://github.com/Automattic/harper) | minor | `v0.38.0` -> `v0.42.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>Automattic/harper (Automattic/harper/harper-ls)</summary>

### [`v0.42.0`](https://github.com/Automattic/harper/releases/tag/v0.42.0)

[Compare Source](Automattic/harper@v0.41.0...v0.42.0)

#### What's Changed

-   feat: kinda of→kind of / kinda by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1363
-   build(deps): bump smallvec from 1.15.0 to 1.15.1 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1379
-   build(deps): bump reqwest from 0.12.18 to 0.12.19 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1380
-   dictionary: add some (mostly) phone-related terms by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1377
-   build(deps): bump hashbrown from 0.15.3 to 0.15.4 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1378
-   fix(core): handle words with multiple dialects by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1372
-   feat(obsidian): misc. QoL improvements by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1382
-   feat: Added ORGMODE parser by [@&#8203;eloycoto](https://github.com/eloycoto) in Automattic/harper#1369
-   feat: `harper-cli` command to rename affix annotation flags by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1348
-   chore: refactor most common affix annotation flags by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1349
-   feat: few time-units ago→a few time-units ago by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1343
-   feat(core): add rule for `some the` -> `some of the` by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1333
-   feat(core): add rule to expand btw by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1329

#### New Contributors

-   [@&#8203;eloycoto](https://github.com/eloycoto) made their first contribution in Automattic/harper#1369

**Full Changelog**: Automattic/harper@v0.41.0...v0.42.0

### [`v0.41.0`](https://github.com/Automattic/harper/releases/tag/v0.41.0)

[Compare Source](Automattic/harper@v0.40.0...v0.41.0)

#### What's Changed

-   Implement server_info by [@&#8203;jvoisin](https://github.com/jvoisin) in Automattic/harper#1341
-   fix: correct and improve verb morphology by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1257
-   docs(sublime-text): added sublime text integration by [@&#8203;ssahayam-zd](https://github.com/ssahayam-zd) in Automattic/harper#1346
-   feat: piece of mind→peace of mind by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1360
-   Dictionary curation 2025 05 30 by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1352
-   feat: fix noun that should be related verb by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1362
-   fix: missing `the` from `SufficeItToSay` message by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1350
-   feat: open a device→turn on a device by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1356
-   fix: don't close compound if open is in dictionary by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1347
-   feat: throw rubbish→throw rubbish away / throw away rubbish by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1274
-   fix: different messages for wrong word vs missing hyphen by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1354
-   feat(obsidian): tweak style of code block by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1367
-   fix: add special case for "how come" by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1279
-   test: `exact_phrase` and `exact_word` differ in case sensitivity by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1361
-   feat: in need for→in need of by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1359
-   build(deps): bump clap from 4.5.38 to 4.5.39 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1358
-   build(deps): bump reqwest from 0.12.15 to 0.12.18 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1357
-   fix: false positives after object case pronouns by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1353
-   feat: `harper-cli compounds` command by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1351
-   dictionary: Add UUID by [@&#8203;jpds](https://github.com/jpds) in Automattic/harper#1371
-   feat:a couple of more→a couple more by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1374
-   feat(chrome-ext): Improve onboarding experience by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1375

#### New Contributors

-   [@&#8203;ssahayam-zd](https://github.com/ssahayam-zd) made their first contribution in Automattic/harper#1346

**Full Changelog**: Automattic/harper@v0.40.0...v0.41.0

### [`v0.40.0`](https://github.com/Automattic/harper/releases/tag/v0.40.0)

[Compare Source](Automattic/harper@v0.39.0...v0.40.0)

#### What's Changed

-   dictionary: Add some chat terms/RSS/OSS by [@&#8203;jpds](https://github.com/jpds) in Automattic/harper#1323
-   feat: spelled-number pattern & since duration linter by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1325
-   feat(ls): allow skipping the version check by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1334
-   fix(ls): do not emit diagnostics on save by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1332
-   Implement a way to get harper-ls version by [@&#8203;jvoisin](https://github.com/jvoisin) in Automattic/harper#1338
-   build: add `release-debug` profile by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1342
-   feat(ls): configurable max length by [@&#8203;86xsk](https://github.com/86xsk) in Automattic/harper#1335
-   feat: unsurmountable→insurmountable, brutalness→brutality by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1339

#### New Contributors

-   [@&#8203;jvoisin](https://github.com/jvoisin) made their first contribution in Automattic/harper#1338

**Full Changelog**: Automattic/harper@v0.39.0...v0.40.0

### [`v0.39.0`](https://github.com/Automattic/harper/releases/tag/v0.39.0)

[Compare Source](Automattic/harper@v0.38.0...v0.39.0)

#### What's Changed

-   fix: use community maintained fork of tower-lsp by [@&#8203;jfly](https://github.com/jfly) in Automattic/harper#1316
-   refactor: make the three compound noun linters consistent by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1294
-   feat: as of lately→as of late by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1319
-   feat: Every day vs Everyday linter by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1265
-   build(deps): bump tokio from 1.45.0 to 1.45.1 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1328
-   feat:point of views→points of view by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1324
-   build(deps): bump uuid from 1.16.0 to 1.17.0 by [@&#8203;dependabot](https://github.com/dependabot) in Automattic/harper#1327
-   fix(vscode-plugin): make test reliable with `waitForDiagnosticChange` by [@&#8203;kiding](https://github.com/kiding) in Automattic/harper#1322
-   Dictionary curation 2025 05 22 by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1321
-   feat:amount for→account for/amount to by [@&#8203;hippietrail](https://github.com/hippietrail) in Automattic/harper#1320
-   fix(chrome-ext): scrolling on Notion + other tweaks by [@&#8203;elijah-potter](https://github.com/elijah-potter) in Automattic/harper#1317

**Full Changelog**: Automattic/harper@v0.38.0...v0.39.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4zMS4wIiwidXBkYXRlZEluVmVyIjoiNDAuNDguMTAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbIlJlbm92YXRlIEJvdCJdfQ==-->
elijah-potter pushed a commit that referenced this pull request Jun 18, 2025
* feat: Added ORGMODE parser

I heavilly use ORGMODE[0] for my notes, and I also love harper. This PR
add the parser for ORGMODE, I also add support to haper-ls and harper-cli.

I know that maybe it's not complete at 100%, but I'm going to work over
needed changes.

0: https://orgmode.org/

Signed-off-by: Eloy Coto <[email protected]>

* feat: orgmode integration tests

Org file from here:
https://github.com/nvim-orgmode/orgmode/blob/32ef9e95f43a6e951fb931b438372546a4f0c524/docs/index.org

Signed-off-by: Eloy Coto <[email protected]>

* Update harper-core/src/parsers/org_mode.rs

Co-authored-by: Grant Lemons <[email protected]>

* chore: fix PR comments

Signed-off-by: Eloy Coto <[email protected]>

---------

Signed-off-by: Eloy Coto <[email protected]>
Co-authored-by: Grant Lemons <[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.

3 participants