profile
viewpoint
Marijn Haverbeke marijnh not interested in recruiter mail Berlin http://marijnhaverbeke.nl Independent open-source programmer person

acornjs/acorn 9735

A small, fast, JavaScript-based JavaScript parser

marijnh/Eloquent-JavaScript 2845

The sources for the Eloquent JavaScript book

lezer-parser/lr 523

Incremental parsing system

codemirror/CodeMirror-v1 360

An editable-iframe based code editor in JavaScript. See https://github.com/marijnh/CodeMirror for the currently maintained version

marijnh/Eloquent-JavaScript-1st-edition 323

The source for http://eloquentjavascript.net

akapav/js 187

JavaScript compiler for Common Lisp

lezer-parser/generator 119

Parser generator for the lezer incremental parser

lezer-parser/common 42

Packed syntax tree data structure

marijnh/browserkeymap 41

Map key events to key names, and key names to values

marijnh/distfs 39

Mount a directory of ES6 code as a FUSE directory of babel-compiled output

issue commentlezer-parser/lezer

Add a printer package

I don't really want to open the @lezer namespace to 3rd-party code. Just lezer-printer or @lezer-unofficial/printer is perfectly fine.

(You are aware of the very basic pretty-printing that Tree.toString provides, no?)

deemp

comment created time in 2 hours

issue commentlezer-parser/lezer

Add a printer package

No. That's not something I'm going to work on.

deemp

comment created time in 5 hours

issue closedlezer-parser/lezer

Add a printer package

Recently, I started making a new parser and discovered there's still no official pretty printer. I found one on the CodeMirror forum (link) and saw the original post has gotten 1.8K views since 2020.

Currently, I packaged that pretty printer (link) to use for my new package. However, it'd be nice to have an official package, with at least some pretty-printing format (not necessarily JSON).

@marijnh, could you please consider adding such a printer to the @lezer family?

closed time in 5 hours

deemp

issue commentacornjs/acorn

Types for LooseParser constructor are wrong

The constructors aren't really part of the public interface. In what situation are you calling them?

connor4312

comment created time in 6 hours

issue closedcodemirror/dev

Assistance Needed with Graded Assignments on Coursera

I hope this message finds you well. I am currently enrolled in the Programming for Everybody (Getting Started with Python) - University of Michigan on Coursera and have encountered persistent issues with Graded Assignment 3.1 and Assignment 2.3. Despite multiple attempts and careful review of the provided materials, I continue to encounter errors even when I believe my code is correct.

I have been working on these assignments for several weeks, and I am eager to resolve the issues to progress in the course. I have included the links to the assignments below for your reference:

Graded Assignment 3.1: [ https://www.py4e.com/tools/pythonauto/?PHPSESSID=8b640d8629795cfa3d157127560c1179 ]

Assignment 2.3: [ https://www.py4e.com/tools/pythonauto/?PHPSESSID=f1014755d5607c2bae9dd9a5b4f02059 ]

I kindly request your assistance in investigating and resolving these issues. I believe there may be technical errors on the platform, as I have followed the instructions closely and reviewed my code thoroughly.

Your prompt attention to this matter would be greatly appreciated. If possible, please provide guidance or solutions to the issues I am facing, or direct me to the appropriate channels for assistance.

Thank you for your support, and I look forward to your response.

closed time in 8 hours

adickdid69

issue commentcodemirror/dev

Assistance Needed with Graded Assignments on Coursera

Sorry, this is not what this bug tracker is for, and this kind of assistance isn't something you'll be able to get here.

adickdid69

comment created time in 8 hours

issue commentmarkdown-it/markdown-it

Maintenance status of markdown-it

To be on the safe side, you could add a wildcard export like this

  "exports": {
    ".": {
      "import": "./dist/esm/markdown-it.mjs",
      "require": "./index.js"
    },
    "./*": {
      "require": "./*",
      "import": "./*"
    }
  },

That way, imports of the root will properly use the ESM build, but direct subpaths are also still supported.

MattIPv4

comment created time in a day

issue commentlezer-parser/lezer

generator runs out of memory on large grammar

The parser-generator algorithm used by this tool definitely has limits, and you'll want to keep your (expanded) grammar size within reasonable bounds. A rule with 600 or-ed tokens sounds like a bad idea. Do these tokens actually serve a different purpose in the grammar, or could you collapse them to a single more generic token type? Optionals and or-expressions are compiled by expanding them into multiple rules (i.e. (a | b) c? becomes a, b, a c, b c), and if you combine a bunch of them you can get a serious blowup in the amount of rules.

nchen63

comment created time in a day

created tagcodemirror/view

tag6.21.0

DOM view component for the CodeMirror code editor

created time in a day

push eventcodemirror/view

Marijn Haverbeke

commit sha 675a5769be236a7c9a6559a93012f9b37b59e31b

Mark version 6.21.0

view details

push time in a day

created tagcodemirror/commands

tag6.3.0

Collection of editing commands for the CodeMirror code editor

created time in a day

issue closedcodemirror/dev

deleteToLineStart with wrapped text doesn't work as expected on the Mac

Describe the issue

This may be a platform difference, but on the Mac, the CMD-Backspace (implemented here in deleteToLineStart should delete to the beginning of the visual line, but instead delete's the the start of the logical line.

With the link below, add enough text to wrap in the window and then use CMD-Backspace. The text will be deleted to the beginning of the logical line, not the visual line.

Browser and platform

Safari, Macintosh

Reproduction link

https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge21hcmtkb3dufSBmcm9tICJAY29kZW1pcnJvci9sYW5nLW1hcmtkb3duIgppbXBvcnQge2xhbmd1YWdlc30gZnJvbSAiQGNvZGVtaXJyb3IvbGFuZ3VhZ2UtZGF0YSIKCi8vIFRoZSBNYXJrZG93biBwYXJzZXIgd2lsbCBkeW5hbWljYWxseSBsb2FkIHBhcnNlcnMKLy8gZm9yIGNvZGUgYmxvY2tzLCB1c2luZyBAY29kZW1pcnJvci9sYW5ndWFnZS1kYXRhIHRvCi8vIGxvb2sgdXAgdGhlIGFwcHJvcHJpYXRlIGR5bmFtaWMgaW1wb3J0LgpsZXQgdmlldyA9IG5ldyBFZGl0b3JWaWV3KHsKICBkb2M6ICJIZWxsb1xuXG5gYGBqYXZhc2NyaXB0XG5sZXQgeCA9ICd5J1xuYGBgIiwKICBleHRlbnNpb25zOiBbCiAgICBiYXNpY1NldHVwLAogICAgbWFya2Rvd24oe2NvZGVMYW5ndWFnZXM6IGxhbmd1YWdlc30pLAogICAgRWRpdG9yVmlldy5saW5lV3JhcHBpbmcKICBdLAogIGxpbmVXcmFwcGluZzogdHJ1ZSwKICBwYXJlbnQ6IGRvY3VtZW50LmJvZHkKfSkK

closed time in a day

gaige

push eventcodemirror/commands

Marijn Haverbeke

commit sha 3ec7f7f82acda1bd505cf65ca7dc0024ba18ab58

Add deleteLineBoundaryForward/Backward, use in macOS bindings FEATURE: The new `deleteLineBoundaryForward` and `deleteLineBoundaryBackward` commands delete to the start/end of the line or the next line wrapping point. FIX: Make Cmd-Backspace and Cmd-Delete on macOS delete to the next line wrap point, not the start/end of the line. Closes https://github.com/codemirror/dev/issues/1269

view details

Marijn Haverbeke

commit sha b6d5695a3bcaf803aa1b077ecf91b2c3269e3596

Mark version 6.3.0

view details

push time in a day

issue commentmarkdown-it/markdown-it

Maintenance status of markdown-it

Could you check result of this PR https://github.com/markdown-it/markdown-it/pull/863/files ? Are ESM exports as expected or some tweaks needed?

I've added a comment to #863

MattIPv4

comment created time in a day

pull request commentmarkdown-it/markdown-it

Support ES Module output in npm package. #862

In 2023, we'll also want an exports field in package.json, something like ...

  "exports": {
    "import": "./index.js",
    "require": "./dist/esm/markdown-it.mjs"
  },

That makes sure resolution that doesn't use the non-standard "module" field (such as node's own) can still find the ESM code.

paulirwin

comment created time in a day

issue commentcodemirror/dev

Feature Request: Include crashed view plugin name in `logException` context

Any further feedback on this? My feeling is that this would be mostly unnecessary complexity, due to the availability of a stack trace.

bradymadden97

comment created time in a day

issue commentcodemirror/dev

Making geometry values in RectangleMarker public

That seems reasonable. Done in attached patch.

cyanzhong

comment created time in a day

issue closedcodemirror/dev

Making geometry values in RectangleMarker public

Hi @marijnh,

This is not a bug report but a small change request in https://github.com/codemirror/view/blob/main/src/layer.ts#L29.

Would it be possible to make these public?

private left;
private top;
private width;
private height;

Asking this because I am leveraging RectangleMarker.forRange to calculate rects, but I am not directly using layers in my case. For example, sometimes I would like to extend the rect to make it longer.

It seems some calculation inside it cannot be used without accessing private properties.

Thanks!

closed time in a day

cyanzhong

push eventcodemirror/view

Marijn Haverbeke

commit sha 7a86d725f419b5c11b607e8262418e326178259b

Make the position of RectangleMarker public FEATURE: `RectangleMarker`'s dimension properties are now public. Closes https://github.com/codemirror/dev/issues/1267

view details

push time in a day

PR closed codemirror/website

fix: set checked in constructor

The checkbox example does not work properly when checked is not set in the constructor.

+1 -1

2 comments

1 changed file

felixroos

pr closed time in a day

issue commentcodemirror/dev

Inline widgets sometimes do not get cleaned up

Thanks for the reproduction. Attached patch fixes this.

Monkatraz

comment created time in a day

issue closedcodemirror/dev

Inline widgets sometimes do not get cleaned up

Describe the issue

I'm not sure how to intentionally trigger this (I do have a repro though), but sometimes when updating decorations with inline widgets the old widgets won't be removed from the DOM. I'm pretty sure that if you scroll away from these broken widgets, they will always get removed from the DOM due to CodeMirror's content virtualization.

Here is a video of what happens:

Screencast from 09-28-2023 02:11:06 PM.webm

My reproduction is based off an old repro I had about inline widgets before/after block widgets. To reproduce:

  • use the repro linked below
  • move your selection around (way you do it shouldn't really matter?)
  • expect the blue inline widgets to get duplicated

Ideally, you should just see a inline -> block -> inline widget following your selection.

Browser and platform

Firefox, Chrome - Linux

Reproduction link

https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge2phdmFzY3JpcHR9IGZyb20gIkBjb2RlbWlycm9yL2xhbmctamF2YXNjcmlwdCIKaW1wb3J0IHsgRGVjb3JhdGlvbiwgV2lkZ2V0VHlwZSB9IGZyb20gJ0Bjb2RlbWlycm9yL3ZpZXcnOwoKY2xhc3MgQmxvY2tXaWRnZXQgZXh0ZW5kcyBXaWRnZXRUeXBlIHsKICB0b0RPTSgpIHsKICAgIGNvbnN0IGRpdiA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpOwogICAgZGl2LnN0eWxlLmJhY2tncm91bmQgPSAncmVkJzsKICAgIGRpdi5zdHlsZS53aWR0aCA9ICc2NHB4JzsKICAgIGRpdi5zdHlsZS5oZWlnaHQgPSAnMTZweCc7CgogICAgcmV0dXJuIGRpdjsKICB9Cn0KCmNsYXNzIElubGluZVdpZGdldCBleHRlbmRzIFdpZGdldFR5cGUgewogIHRvRE9NKCkgewogICAgY29uc3Qgc3BhbiA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3NwYW4nKTsKICAgIHNwYW4uc3R5bGUuYmFja2dyb3VuZCA9ICdibHVlJzsKICAgIHNwYW4uc3R5bGUuY29sb3IgPSAnd2hpdGUnOwogICAgc3Bhbi50ZXh0Q29udGVudCA9ICdpbmxpbmUnOwoKICAgIHJldHVybiBzcGFuOwogIH0KfQoKY29uc3QgbGVmdCA9IERlY29yYXRpb24ud2lkZ2V0KHsKICB3aWRnZXQ6IG5ldyBJbmxpbmVXaWRnZXQoKSwKICBzaWRlOiAtMSwKfSk7Cgpjb25zdCBibG9jayA9IERlY29yYXRpb24ud2lkZ2V0KHsKICB3aWRnZXQ6IG5ldyBCbG9ja1dpZGdldCgpLAogIGJsb2NrOiB0cnVlLAogIGlubGluZU9yZGVyOiB0cnVlLAogIHNpZGU6IDEsCn0pOwoKY29uc3QgcmlnaHQgPSBEZWNvcmF0aW9uLndpZGdldCh7CiAgd2lkZ2V0OiBuZXcgSW5saW5lV2lkZ2V0KCksCiAgc2lkZTogMiwKfSk7Cgpjb25zdCBkZWNvID0gRWRpdG9yVmlldy5kZWNvcmF0aW9ucy5jb21wdXRlKFsnc2VsZWN0aW9uJ10sIChzdGF0ZSkgPT4gewogIGNvbnN0IHBvcyA9IHN0YXRlLnNlbGVjdGlvbi5tYWluLmhlYWQ7CiAgCiAgY29uc3QgcmFuZ2VzID0gWwogICAgbGVmdC5yYW5nZShwb3MpLAogICAgYmxvY2sucmFuZ2UocG9zKSwKICAgIHJpZ2h0LnJhbmdlKHBvcykKICBdOwoKICByZXR1cm4gRGVjb3JhdGlvbi5zZXQocmFuZ2VzLCB0cnVlKTsKfSk7CgoKbmV3IEVkaXRvclZpZXcoewogIGRvYzogImNvbnNvbGUubG9nKCdoZWxsbycpXG4iLAogIGV4dGVuc2lvbnM6IFtiYXNpY1NldHVwLCBqYXZhc2NyaXB0KCksIGRlY29dLAogIHBhcmVudDogZG9jdW1lbnQuYm9keQp9KQo=

closed time in a day

Monkatraz

push eventcodemirror/view

Marijn Haverbeke

commit sha 315df18f841d6395ceae90f6fc13ec350743e4d0

Fix a bug that could cause widgets at the start of a line to leak FIX: Fix a bug that could cause zero-length widgets at the start of a line to be left in the view even after they were removed. Closes https://github.com/codemirror/dev/issues/1268

view details

push time in a day

pull request commentcodemirror/website

fix: set checked in constructor

The readonly checked syntax in TypeScript means precisely this—initialize that property to the value of the argument. What makes you think it does not work?

felixroos

comment created time in 2 days

issue closedcodemirror/codemirror5

Codemirror will show error when using elements get from getElementsByClassName

<!-- Do not use this bug tracker for questions. We have a forum (https://discuss.codemirror.net) for those.

In order to get us to look at something, you need to make it easy for us to understand what you are doing and what went wrong. When possible, a code example that demonstrates the problem helps a lot. If there's any chance at all that a problem is related to the browser, include information about which browser(s) you tested with. -->

Codemirror will show error when using elements get from getElementsByClassName, however, if I change the code to getElementById, it will work.

Error: codemirror_6.65.7_codemirror.min.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'body') at N (codemirror_6.65.7_codemirror.min.js:1:1800) at p.fromTextArea (codemirror_6.65.7_codemirror.min.js:1:168905) at loadHighlight (highlight.js:30:20) at load (highlight.js:23:5) at window.onload (model.html?u=/lessons/ch/1.html:12:17) N @ codemirror_6.65.7_codemirror.min.js:1 p.fromTextArea @ codemirror_6.65.7_codemirror.min.js:1 loadCodeHighlight @ highlight.js:30 load @ highlight.js:23 window.onload @ model.html?u=/lessons/ch/1.html:12 load(async) (anonymous) @ model.html?u=/lessons/ch/1.html:11

Example code: var elements = document.getElementsByClassName("codeTextarea"); for(var a in elements){ CodeMirror.fromTextArea(elements[a], { lineNumbers: true, mode: "text/x-csharp" }); }

closed time in 2 days

gaoe6661

issue commentcodemirror/codemirror5

Codemirror will show error when using elements get from getElementsByClassName

This is definitely going to be related to the actual value you're passing in, not whether it is coming from getElementById or getElementsByClassName. It is not a CodeMirror problem.

gaoe6661

comment created time in 2 days

created tagcodemirror/merge

tag6.1.3

Merge view for CodeMirror

created time in 2 days

push eventcodemirror/merge

Marijn Haverbeke

commit sha bb9a2ece768b4771a565891b35fdee909a7a99c7

Mark version 6.1.3

view details

push time in 2 days

push eventcodemirror/merge

Marijn Haverbeke

commit sha 8429d56b9bad8a810d98cfda891b20734e384ebd

Generate spacers for the whole document FIX: Create alignment spacers for the whole document, not just the viewport, to avoid scroll position popping and misalignment. See https://discuss.codemirror.net/t/editor-lines-out-of-sync-in-merge-view/7138

view details

push time in 2 days

issue commentcodemirror/dev

next is undefined in ChildCursor

This could be a number of things—the selection somehow containing invalid positions, the content tree being broken, or some logic mistake in way it is being scanned. If someone manages to catch it, the values of view.docView.toString() and view.state.selection.toJSON() would be useful for narrowing it down. But of course, a set of reproduction instructions would be even better.

ondrejmirtes

comment created time in 3 days

more