profile
viewpoint
Marijn Haverbeke marijnh Berlin http://marijnhaverbeke.nl Independent open-source programmer person

acornjs/acorn 6546

A small, fast, JavaScript-based JavaScript parser

marijnh/Eloquent-JavaScript 2459

The sources for the Eloquent JavaScript book

codemirror/CodeMirror-v1 358

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

marijnh/Eloquent-JavaScript-1st-edition 317

The source for http://eloquentjavascript.net

lezer-parser/lezer 250

Incremental parsing system

akapav/js 169

JavaScript compiler for Common Lisp

lezer-parser/lezer-generator 43

Parser generator for the lezer incremental parser

marijnh/browserkeymap 40

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

marijnh/distfs 40

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

marijnh/cetriolo 21

Time management tool

push eventmarijnh/style-mod

Marijn Haverbeke

commit sha f9f74b4f5480549b3d060ee35abf74c2c1d48b17

Fix missing docs in README

view details

push time in a day

push eventlezer-parser/javascript

Marijn Haverbeke

commit sha 3c2c4804e82bcc792402fd6a27f60792dd5abdb3

Remove accidentally committed half-baked test

view details

push time in 2 days

push eventlezer-parser/lezer-generator

Marijn Haverbeke

commit sha 75216cbca78f58fe2858b91ee8582706ea26c662

Avoid indirection when a state's actions are all shared

view details

Marijn Haverbeke

commit sha 377b15729bd62ca067765fa3d9300ca452962b56

Adjust tests to changes in tree interface

view details

Marijn Haverbeke

commit sha b936b311217b8b4d92b27823d38c84b441965070

Follow changes in lezer-tree interface

view details

Marijn Haverbeke

commit sha 89e3078bde85ea0cc41dea5d7956446afe49ef9f

Adjust to introduction of node type flags BREAKING: The serialized parser format changed.

view details

Marijn Haverbeke

commit sha 95db01388e33ec5f6669f2ccdd1a840cf9972161

Emit a version number with serialized parsers

view details

push time in 2 days

push eventlezer-parser/lezer

Marijn Haverbeke

commit sha aa0463e279502670ecebb63408185f963cf25416

Adjust tree re-exports for Subtree->TreeCursor change BREAKING: Follow the change from `Subtree` to `TreeCursor` in lezer-tree.

view details

Marijn Haverbeke

commit sha d5a82d92c417160fdfdebdc9facc3bbbe2b76510

Follow changes in lezer-tree's interface

view details

Marijn Haverbeke

commit sha ce09af5475c5623eaffedc8bdc8573ac90c238c5

Follow change to node type flags BREAKING: The serialized parser format changed.

view details

Marijn Haverbeke

commit sha 4e04e3a2a9d8d9dee5ec4d0320cc88c371fa5d2a

Require a version number in serialized parsers To avoid obscure errors on mismatches

view details

push time in 2 days

push eventlezer-parser/lezer-tree

Marijn Haverbeke

commit sha 90c77d496988354364754bf70a8d648a014ae0ff

Start putting tests in this repository And move to rollup for building.

view details

Marijn Haverbeke

commit sha 61bac7c7c93829870f50a06f94e56f6aaa8f68eb

Start on external tree iterators

view details

Marijn Haverbeke

commit sha f7d7ce610fb3377db210a70bd0bf7344094a1c99

Improve TreeIterator implementation, add support for node-end returns

view details

Marijn Haverbeke

commit sha 941dce1305bbe4518986d70dd3db53e5a4f4017a

Add leave method to tree iterators

view details

Marijn Haverbeke

commit sha bae39c8aa687be5c89eebda6e04057418d2b1e6d

Add support for skipping ahead in tree iterators

view details

Marijn Haverbeke

commit sha 65844159daa341e57630c5831850fcd85c6d50db

Make tree iterators resettable

view details

Marijn Haverbeke

commit sha c8f52d7d787e4a957ec2472d356b46fbabf6894c

Allow a subtree to be created from a tree iterator

view details

Marijn Haverbeke

commit sha 5d5daf97ed4487a2a5ee33df7944a0b13652da5d

Immutable position experiment

view details

Marijn Haverbeke

commit sha e93c8967eca79262f7917a95e859c8b890a23170

Make getting a subtree from an iterator work

view details

Marijn Haverbeke

commit sha 1866626906d0539a3052e96d72de57748c9622cf

Immutable position experiment

view details

Marijn Haverbeke

commit sha 10a36aa8444bcf7f7a077f06df5e2f2c2dd99258

Synthesis of cursor and positions

view details

Marijn Haverbeke

commit sha 94560cdd9af7de461482bde660cb51e9d8a65a15

Wrap the new approach in a TreeCursor object

view details

Marijn Haverbeke

commit sha dab7eb7476b2301d69d9c13853df53674eb666a7

Fix leaky side effect issue in TreeCursor.next

view details

Marijn Haverbeke

commit sha e96a6f4b09c2e29a881fd73c083b23d067707045

Add support for reverse iteration

view details

Marijn Haverbeke

commit sha 9f6e86d53fe45084a9bc3fad23b676047d002235

Restore getting a subtree from a cursor

view details

Marijn Haverbeke

commit sha 1d4ba9b04995b298a6b3c01e3e2e41b2e53aeda4

Move resolve over to internally use a tree cursor

view details

Marijn Haverbeke

commit sha d73288b58e3ac4081d1e83d909d41bd83a8149a6

Remove old iterate interface

view details

Marijn Haverbeke

commit sha ce20ecb6e0642575654e1e99210bc127b29ff096

Drop child access from Subtree interface

view details

Marijn Haverbeke

commit sha 85e6cfb17320c34e87cea86b1a7bd53431208da8

Unify Subtree and TreeCursor To simplify the interface. FEATURE: The package now offers a `TreeCursor` abstraction, which can be used for both regular iteration and for custom traversal of a tree.

view details

Marijn Haverbeke

commit sha 7277a2b810c0bc9dd5ade7e9af603876a4c23f95

Back to always-mutable tree cursors

view details

push time in 2 days

issue closedcodemirror/CodeMirror

hknn

https://github.com/codemirror/CodeMirror/blob/41077c866c65c9c905f662306a67d54a7cf56d85/demo/vim.html#L101-L110

closed time in 2 days

memewooow

issue closedcodemirror/codemirror.next

preact integration issue

Hi

I'm trying to integrate CodeMirror 6 in a preact app like below. However, the linenumbers don't show up and I've spent several hours debugging but can't figure out why. Could you please help?

Thanks!

import {EditorView} from "@codemirror/next/view"
import {EditorState} from "@codemirror/next/state"
import {lineNumbers} from "@codemirror/next/gutter"
import {gutter} from "@codemirror/next/gutter"
import {oneDark} from "@codemirror/next/theme-one-dark"
import {search} from "@codemirror/next/search"

import {useEffect, useRef} from "react"

const createEditor = (ed) => {

	const ln = lineNumbers();

	new EditorView({
		parent: ed, 
		state: EditorState.create({
			doc: "Hi there\nHello"
		}),
		extensions: [
			gutter(),
			ln,
			oneDark
		]
	})
}

const CodeMirror = () => {
	const s = {
		height: '100%'
	}

	const ed = useRef();

    useEffect(() => {
		createEditor(ed.current);
	})

	return (
		<div id="cm" ref={ed} style={s}></div>
	);
}

export default CodeMirror;

closed time in 3 days

dev4light

issue commentcodemirror/codemirror.next

preact integration issue

Right. This is the bug tracker, and I don't intend to debug integration with other libraries. If you narrow this down to something specific that CodeMirror does and could be changed, feel free to open an issue, but you'll have to do to the debugging yourself.

dev4light

comment created time in 3 days

pull request commentcodemirror/codemirror.next

Add json parse linter to json-lang package

Thanks. Two more nitpicks: this project uses semicolon-less style, and we target IE11, which doesn't have Number.isNaN. But since \d+ will only ever match integers, the check seems unnecessary in general.

PhilippRaab

comment created time in 3 days

pull request commentcodemirror/codemirror.next

Add json parse linter to json-lang package

This seems to assume V8's error message format (for example, Firefox emits something like "SyntaxError: JSON.parse: expected double-quoted property name at line 1 column 12 of the JSON data"). It'd be good to at least cover all major browsers.

Also, can't you just use state.doc.toString() instead of the Array.from invocation that you have there? state.doc is never null, so the ?? is superfluous too.

PhilippRaab

comment created time in 3 days

issue commentcodemirror/CodeMirror

auto indenting is wrong in JavaScript mode in a multi-line template string?

Look closer at how the bug was closed. It was done via a patch that fixes this.

greggman

comment created time in 3 days

push eventcodemirror/CodeMirror

Marijn Haverbeke

commit sha 9885241fe9dee2415f988d3a3619421f45ce8c6b

[javascript mode] Don't indent in template strings Closes #6442

view details

push time in 3 days

issue closedcodemirror/CodeMirror

auto indenting is wrong in JavaScript mode in a multi-line template string?

version 5.58.1

If you have code like this

const s = `
{  //  on the next line type 4 spaces and then a 
`;

// what should happen? the { should be 4 spaces out
// what happens instead, the spaces are removed

And follow the directions above, type [space] [space] [space] [space] [{] the spaces are deleted. That seems unintentional?

In other words I want this

const s = `
{
    {

but I get this

const s = `
{
{

repo:

https://jsgist.org/?src=7e596608ea9ebfb166cfd21467accbfc

closed time in 3 days

greggman

issue commentcodemirror/codemirror.next

Mouse click on scroll bar in autocompletion triggers selection of first element

Right, that code was a mess. Attached patch should make it more robust.

PhilippRaab

comment created time in 3 days

push eventcodemirror/codemirror.next

Marijn Haverbeke

commit sha 7cd9fd47dd8a70b0efa73c7f2fbd0755cf2da8e5

Make completion click handler more robust FIX: Clicking on the completion list scrollbar no longer selects the first completion. Closes #315

view details

push time in 3 days

issue closedcodemirror/codemirror.next

Mouse click on scroll bar in autocompletion triggers selection of first element

When the scrollbar is visible in the autocompletion, the click on the scroll bar triggers the selection of the first autocompletion option. There is no way to scroll by click and drag.

Found on Windows in Google Chrome: autocomplete

closed time in 3 days

PhilippRaab

push eventcodemirror/CodeMirror

Mark Boyes

commit sha 9caacec1900d71a971561147ba1e8acb2f08609c

[sparql mode] Improve parsing of IRI atoms * Do not treat the opening '<' of an expanded IRI atom as an operator The existing code would not highlight the IRI atom "<foo#bar>" in the following line as an atom. FILTER( ?x = "42"^^<foo#bar> ) for example everything after the # would be highlighted as a comment. This is because the sequence "^^<" while all "operator characters", are not all SPARQL operators in this case: the "<" introduces the IRI atom. I special-case the "^^". * Improve PN_LOCAL parsing to SPARQL 1.1 The following legal sequences of characters from SPARQL 1.1 are additionally parsed as being the right-hand-side of a prefixed IRI. 1) Colons 2) PERCENT escaping 3) PN_LOCAL_ESCAPE escaping

view details

push time in 4 days

PR merged codemirror/CodeMirror

Improve parsing of IRI atoms (sparql mode)

Do not treat the opening "<" character of an unprefixed Datatype IRI as an operator along with the preceding "^^" characters. e.g. the following literal contains three characters in a row, ^^< that are "operator characters" but the third is the first character of the atom that follows two operators.

"42"^^http://www.w3.org/2001/XMLSchema#integer

Respect the SPARQL 1.1 percent-encoding and backslash-escaping within the suffix of a prefixed IRI (and add colons to the set of allowable IRI characters). For example these are legal IRI atoms and with this change are highlighted as such..

foo:b/r#xyz foo:b%25r#xyz

To address a single issue of everything after the last "#" within an IRI (a common character in IRIs) being highlighted as if it were a comment in some common prefixed and unprefixed cases, including all of these examples.

+12 -2

0 comment

1 changed file

MarkBoyes

pr closed time in 4 days

pull request commentcodemirror/CodeMirror

Improve parsing of IRI atoms (sparql mode)

What exactly is the ^-related code parsing? .next() will consume the character, so as it stands, it looks like it is dropping non-caret characters on the floor with the ch = stream.next() call.

MarkBoyes

comment created time in 4 days

issue closedProseMirror/prosemirror

Question: would a client id of 1 for “our” client and client id of 2 for “other” clients work for collaborative editing?

This is a question, mostly looking to validate a design I’m considering. Could I use prosemirror-collab with only two client ids? Where 1 represents “our” client and 2 represents everyone else? So locally everyone would think their id is 1. I’m considering this design because the realtime networking layer already has the concept of “our” realtime payloads vs “other” realtime payloads so reusing that concept would simplify the design of the system a bit.

Looking at the code, it would appear that client ids are only really used to determine ”our” vs “other” transactions but wanted to validate that the design makes sense.

closed time in 4 days

calebmer

issue commentProseMirror/prosemirror

Question: would a client id of 1 for “our” client and client id of 2 for “other” clients work for collaborative editing?

Since client ids, in receiveTransaction tend to come from the server, I don't see how this could work, since in the server, the distinction between 'our' and 'other' isn't meaningful.

In the future, please use the forum, not the bug tracker, to ask questions.

calebmer

comment created time in 4 days

issue commentProseMirror/prosemirror

Inconsistent behaviour in Chrome based on presence of "href" attribute

(Using marks instead of nodes for links is going to be a lot easier, if you don't have a pressing reason you need a node.)

rudolfbyker

comment created time in 4 days

PR closed ProseMirror/website

Update README.md
+1 -1

0 comment

1 changed file

AryaVashisht

pr closed time in 4 days

issue closedProseMirror/prosemirror

Inconsistent behaviour in Chrome based on presence of "href" attribute

Steps to reproduce

  1. Open this example
    • https://glitch.com/edit/#!/juniper-lyrical-fontina
    • https://juniper-lyrical-fontina.glitch.me/
  2. Place the cursor after the word "llama".
  3. Type any text, e.g. !.
  4. Expected behaviour: The text should either be inside or outside the llama node. Not sure which is best, but it should be consistent. My preference would be how it behaves on Firefox, where it depends on whether the cursor is inside or outside the node, which again depends on from which side you navigated towards that position. My use case is that I want to allow the user to append text inside an inline node.
  5. Actual behaviour:

The actual behaviour depends on the type of tag used (to test it yourself, modify lines 14 and 19 of index.js and line 13 of index.html) and whether the href attribute is added in the toDOM function (comment out line 21 of index.js).

... Firefox Chrome
a with href <a href="http://example.com">I am a llama!</a> <a href="http://example.com">I am a llama</a>!
a without href <a>I am a llama!</a> <a>I am a llama!</a>
span with href <span href="http://example.com">I am a llama!</a> <span href="http://example.com">I am a llama!</a>
span without href <span>I am a llama!</a> <span>I am a llama!</a>

Notes:

  • I omitted style attributes for brevity.
  • I know span with href is nonsensical. It's just for argument's sake.

ProseMirror version

Whatever version is hosted at https://prosemirror.net/examples/prosemirror.js

Affected platforms

  • [x] Chrome
  • [x] Firefox

Did not test on IE, because I'm on Linux.

closed time in 4 days

rudolfbyker

issue commentProseMirror/prosemirror

Inconsistent behaviour in Chrome based on presence of "href" attribute

This is a known and intentional limitation of the library—browsers don't provide control over this, and there's no one-size-fits-all way to fix it in the library. See this thread for background. You'll need to do your own handling of cursor motion and editing around the inline node type if you want this kind of structure and consistent behavior.

rudolfbyker

comment created time in 4 days

issue closedProseMirror/prosemirror

[Firefox]: Entering text at the end of a line with `white-space: pre-line` drops spaces

Issue details

For some reasons we needed to configure out prosemirror editor element with white-space: pre-line. This worked just fine in Chrome, but produces really odd issues in Firefox:

  1. One cannot enter more than one consecutive space character at the end of a line
  2. Entering a space followed by a non-space will remove the space character
  3. Entering text in the middle of a line works just fine.

Switching to white-space: pre-wrap resolves the issues for us.

Steps to reproduce

See glitch example here: https://glitch.com/edit/#!/sunny-enshrined-lock?

ProseMirror version

Unclear to specify, whatever the glitch basic setup uses right now reproduces it.

Seen in our app with remirror 1.0.0-next.49, which depends on these:

    "prosemirror-commands": "^1.1.4",
    "prosemirror-dropcursor": "^1.3.2",
    "prosemirror-gapcursor": "^1.1.5",
    "prosemirror-history": "^1.1.3",
    "prosemirror-inputrules": "^1.1.3",
    "prosemirror-keymap": "^1.1.4",
    "prosemirror-model": "^1.11.2",
    "prosemirror-schema-list": "^1.1.4",
    "prosemirror-state": "^1.3.3",
    "prosemirror-suggest": "^1.0.0-next.49",
    "prosemirror-tables": "^1.1.1",
    "prosemirror-transform": "^1.2.8",
    "prosemirror-view": "^1.16.0"

Affected platforms

  • [ ] Chrome
  • [x] Firefox
  • [ ] Internet Explorer (not tested)
  • [ ] Other (not tested)

Screenshots / Screencast (Optional)

Video

closed time in 4 days

ankon

issue commentProseMirror/prosemirror

[Firefox]: Entering text at the end of a line with `white-space: pre-line` drops spaces

Using different white-space styling is not something the library aims to support, sorry.

ankon

comment created time in 4 days

issue commentcodemirror/codemirror.next

Pressing Shift + Enter, insert a "NL" character

The DOM content reader was getting confused by the way Chrome's default shift-enter binding changed the DOM. This led me to finally take care of a related FIXME comment, so that's good.

maxxcs

comment created time in 5 days

issue commentProseMirror/prosemirror-markdown

Adding images after spaces wraps image markdown in code block

Markdown, unfortunately, turns out to be somewhat problematic as a serialization format when users aren't directly writing it, since it has a bunch of these corner cases that make some documents unrepresentable.

I don't think I'll be able to address this one at in this module, so I'm closing this issue.

buddh4

comment created time in 5 days

push eventcodemirror/codemirror.next

Marijn Haverbeke

commit sha 33ad7fc61c985658caf4a3200432b4601a1f791a

Don't get confused then line breaks end up in the editable DOM FIX: Fix an issue where Chrome's shift-enter shortcut confused the editor. Closes #314

view details

push time in 5 days

issue closedcodemirror/codemirror.next

Pressing Shift + Enter, insert a "NL" character

image

This happens on a Chrome 86.0.4240.75 (64-bit) on Windows 10, but it also happened on a Mint.

closed time in 5 days

maxxcs

issue commentProseMirror/prosemirror-markdown

Adding images after spaces wraps image markdown in code block

Ah, okay, that doesn't appear to be related to images, since the same thing happens with text. It seems Markdown doesn't provide a way to escape spaces, and requires parsers to strip leading spaces. So there's not much this serializer can do to preserve those.

More generally, having spaces at the start of a paragraph like that suggests you're trying to do layout with spaces, which is rarely a good idea anyway (HTML will collapse them, for example).

buddh4

comment created time in 5 days

push eventProseMirror/prosemirror-markdown

Marijn Haverbeke

commit sha 65caf3c67c0946f61aa7898d16ad027d898905fc

Allow leading space when escaping line numbers And fix a typo in a comment

view details

push time in 5 days

issue commentProseMirror/prosemirror-markdown

Adding images after spaces wraps image markdown in code block

Could you describe more precisely what you are doing? Adding an image after a space to the document in the ProseMirror editor on https://prosemirror.net/examples/markdown/ and then switching to markdown doesn't do anything unexpected.

buddh4

comment created time in 5 days

issue commentcodemirror/codemirror.next

YAML language support

Hah. That's what I was afraid of. Probably running the CM5 mode in stream-syntax is the least annoying option for the time being.

juliusv

comment created time in 5 days

issue commentcodemirror/codemirror.next

Theme style precedence is hard to manage

Attached patch always adds the main selector, making sure that theme-based selectors aren't shadowed by base + light/dark selectors. The general problem of CSS specificity isn't solved by that, so some care must still be taken, but it's less error-prone now.

marijnh

comment created time in 5 days

created tagcodemirror/codemirror.next

tag0.13.1

The next generation of the CodeMirror in-browser editor

created time in 5 days

push eventcodemirror/codemirror.next

Marijn Haverbeke

commit sha 173d9f880c7d3de7aeed5c7e6467231908297679

Add base theme id to style selectors To boost their precedence. Closes #309

view details

Marijn Haverbeke

commit sha f0630628dcddf3a7f66fce4bd57e07885fad4228

Boost contrast on one-dark gutter text

view details

Marijn Haverbeke

commit sha 2fd1fdf5de9e212a8a2420ff84e304a92d77de4d

Fix bug in Change.fromJSON FIX: Fix a bug that caused `Change.fromJSON` to return invalid change objects in some cases.

view details

Marijn Haverbeke

commit sha cb636460ca496708de36764d3e0d012be2e80350

Add release notes FIX: Fix a bug where the selection and cursor were drawn in the wrong place in a scrolled editor.

view details

Marijn Haverbeke

commit sha 733d8ba33c70a5a353ad3f35f099ce6be243dc3b

Mark version 0.13.1

view details

push time in 5 days

issue closedcodemirror/codemirror.next

Theme style precedence is hard to manage

With 9fa3bcafd0fc82, themes can use more complicated selectors—which was often necessary—but that makes them subject to CSS's own precedence behavior again, which can be awkward and hard to predict. For example, the base theme defines a style for $$focused$light $cursor (.ID.cm-focused.cm-light .cm-cursor), and a theme that just styles $cursor, which would be a reasonable thing to do, will simply be overridden by the default cursor color.

I'd be nice if real themes always override rules from base themes, but CSS doesn't have a good way to express that. Not sure how, short of adding a bunch of bogus classes to boost rules' precedence, to address this.

closed time in 5 days

marijnh

issue commentcodemirror/codemirror.next

YAML language support

I'm unlikely to work on this myself, so this'd be a great candidate for a 3rd party implementation.

juliusv

comment created time in 5 days

issue commentcodemirror/codemirror.next

Allow more control over autocomplete completion info tooltip positioning

Attached patch adds cm-tooltip-completionInfo-left/right classes to the element. Does that work for you?

juliusv

comment created time in 5 days

push eventcodemirror/codemirror.next

Marijn Haverbeke

commit sha b5704dbda516e415afb5d1e66f3961cbdf8f1415

Add orientation classes to tooltips and completion info popups Issue #312

view details

push time in 5 days

issue closedcodemirror/codemirror.next

Expose CompletionContext constructor

Currently it's not possible to create on user side the object CompletionContext with a custom EditorState and a custom position

https://github.com/codemirror/codemirror.next/blob/master/autocomplete/src/completion.ts#L44-L55

This is useful when you want to test the completion method that will be injected later into CodeMirror as an extension.

Like that for example:

describe('autocomplete promQL test', () => {
  const testCases = [
    {
      title: 'simple metric autocompletion',
      expr: 'go_',
      pos: 3,
      prometheusClient: undefined,
      expectedResult: Promise.resolve(),
    },
  ];
  testCases.forEach((value) => {
    it(value.title, () => {
      const state = createEditorState(value.expr);
      const context = new CompletionContext(state, value.pos, true);
      const completion = new HybridComplete(value.prometheusClient);
      chai.expect(value.expectedResult).to.equal(completion.promQL(context));
    });
  });
});

Would you be ok to expose the constructor of the object CompletionContext ?

closed time in 5 days

Nexucis

issue commentcodemirror/codemirror.next

Expose CompletionContext constructor

That seems reasonable. Done in bcb6dac

Nexucis

comment created time in 5 days

push eventcodemirror/codemirror.next

Marijn Haverbeke

commit sha 5731f16b62b6f1f01d3c4741da04185f5a4dbef1

Remove accidentally committed code

view details

Marijn Haverbeke

commit sha bcb6dac25823d038dd7ae29a4e96a1d29ca9c12c

Expose CompletionContext constructor

view details

push time in 5 days

issue commentcodemirror/CodeMirror

[merge] Add support for line mode

That'd be reasonable, and would be a small change, I guess. Want to submit a patch?

sampotts

comment created time in 6 days

issue closedcodemirror/google-modes

[kt] Kotlin 1.4 support: minimally fun interfaces appear broken

Kotlin 1.4 introduces a few features that may affect parsing/syntax highlighting, notably:

  • fun interface declarations: these currently look broken, apparently because codemirror expects a function declaration after the fun keyword. Instead, fun should be treated as a modifier here (while leaving function declarations unchanged).
  • trailing commas affect function declarations and invocations, but seem to already be tolerated/handled
  • type annotations may affect parsing of types, including function types, e.g., fun foo(init: @Bar Baz.(@Bar Foo)->String): @Bar String

closed time in 7 days

kevin1e100

issue commentcodemirror/google-modes

[kt] Kotlin 1.4 support: minimally fun interfaces appear broken

Sure. Attached patch adds support for fun interface (as I understand it from your explanation, not being a Kotlin programmer myself). The grammar seems to already allow annotations in front of types. If that doesn't cover your 3rd point, please elaborate.

kevin1e100

comment created time in 7 days

push eventcodemirror/google-modes

Marijn Haverbeke

commit sha 57b26bb0e76ca5d3b83b12faf13ce1054d34bddf

[kotlin mode] Allow 'fun interface' declarations Issue #320

view details

push time in 7 days

issue closedacornjs/acorn

npm version tags point to wrong versions

Similar to #932

The current tags are as follows:

Tag Version
latest 6.4.2 (should be 8.0.4)
previous 6.4.0 (should be 7.4.1)

Also it would be nice if you could then also tag 6.4.2 as v6 as that one will no longer have any dist-tag after these changes. And likewise maybe 5.7.4 as v5?

As seen on NPM:

image

closed time in 7 days

Favna

issue commentacornjs/acorn

npm version tags point to wrong versions

Ugh, sorry, I forgot about that npm foot-gun again. I've updated latest and removed previous, since I don't intend to keep that pointing at the correct package in the future.

Favna

comment created time in 7 days

PR closed ProseMirror/website

improved docs invalid
+1 -1

1 comment

1 changed file

sidkhurana3630

pr closed time in 8 days

pull request commentProseMirror/website

improved docs

I know you're just a doofus following a stupid youtube video, but please, going forward, try to not spam maintainers with this kind of stuff. You're not going to get a t-shirt for such pull requests anyway.

sidkhurana3630

comment created time in 8 days

created tagProseMirror/prosemirror-model

tag1.12.0

ProseMirror's document model

created time in 8 days

push eventProseMirror/prosemirror-model

Marijn Haverbeke

commit sha 9ed7f47f88be143fedb2d9b1092a2640ec658e55

Allow DOMOutputSpec values to already be {dom, contentDOM} objects FEATURE: The output of `toDOM` functions can now be a `{dom, contentDOM}` object specifying the precise parent and content DOM elements. See https://discuss.prosemirror.net/t/contentdom-when-returning-a-dom-node-from-todom/3209

view details

Marijn Haverbeke

commit sha 31cf53a479b9fff10e8715ee4f45883e5c5c9a33

Mark version 1.12.0

view details

push time in 8 days

issue commentcodemirror/CodeMirror

Gutter issue

You didn't provide remotely enough context for us to see what might be going on. This might be a CSS conflict. Try removing custom CSS or other things that might interact with the editor and see what's the minimal code needed to reproduce the problem.

dat15021999

comment created time in 8 days

issue closedacornjs/acorn

acorn-loose does not allow top-level async for-of

acorn can successfully parse a top-level async for-of statement, but acorn-loose fails to do so if passed the same set of options:

> require('acorn').parse('for await (const foo of bar()) {}', { ecmaVersion: 'latest', allowAwaitOutsideFunction: true });
Node {
  type: 'Program',
  start: 0,
  end: 33,
  body: [
    Node {
      type: 'ForOfStatement',
      start: 0,
      end: 33,
      await: true,
      left: [Node],
      right: [Node],
      body: [Node]
    }
  ],
  sourceType: 'script'

acorn-loose:

> require('acorn-loose').parse('for await (const foo of bar()) {}', { ecmaVersion: 'latest', allowAwaitOutsideFunction: true });/
Node {
  type: 'Program',
  start: 0,
  end: 33,
  body: [
    Node {
      type: 'ForStatement',
      start: 0,
      end: 20,
      init: [Node],  <- dummy node
      update: null,
      test: null,
      body: [Node]
    },
    Node {
      type: 'ExpressionStatement',
      start: 21,
      end: 23,
      expression: [Node]
    },
    Node {
      type: 'ExpressionStatement',
      start: 24,
      end: 29,
      expression: [Node]
    },
    Node { type: 'BlockStatement', start: 31, end: 33, body: [] }
  ],
  sourceType: 'script'
}

closed time in 8 days

connor4312

issue commentacornjs/acorn

acorn-loose does not allow top-level async for-of

Attached patch fixes this.

connor4312

comment created time in 8 days

push eventacornjs/acorn

Marijn Haverbeke

commit sha 2739d8b3c843e8910b02a5234566fa9774272793

[loose parser] Always allow 'for await' Issue #988

view details

Marijn Haverbeke

commit sha 7f8799a82f733794b88c85ef7893753b59756c39

Mark acorn-loose 8.0.1

view details

push time in 8 days

issue closedcodemirror/codemirror.next

Is there a way to "clearOnEnter" on WidgetType?

I have a simple class HeaderIndicatorWidget extends WidgetType, which is basically a "span" tag, and is added using Decoration.replace(). However there isn't seem to be an option that clear the widget when the cursor reaches the widget. As a result, when I press arrow key to move the cursor, the cursor stays and jump to the left/right of the widget.

closed time in 9 days

fuermosi777

issue commentcodemirror/codemirror.next

Is there a way to "clearOnEnter" on WidgetType?

No, this has to be handled by whoever manages the decoration state. You can see how the code folding extensions handles it here.

fuermosi777

comment created time in 9 days

push eventacornjs/acorn

星灵

commit sha d87c4b75f73d7009c8ba8c8f4d4de1cb118831e8

chore: update license year

view details

push time in 9 days

PR merged acornjs/acorn

chore: update license year
+3 -3

0 comment

3 changed files

YGYOOO

pr closed time in 9 days

issue commentcodemirror/codemirror.next

CommonJS is not supported, it makes the lib unable to be imported in React (if a test exists)

I think there is an issue for lezer-parser: the package is defined as a "module" but main references a cjs script

"main" is just there as a fallback for older node versions. "exports", when present, will take precedence on Node 13+.

dubzzz

comment created time in 10 days

issue commentProseMirror/prosemirror

Allow asynchronous toDOM()?

No, sorry, this would be too much of a headache and complexity-bomb for me to be interested in it.

strogonoff

comment created time in 10 days

issue closedProseMirror/prosemirror

Allow asynchronous toDOM()?

Issue details

It could be useful to allow node spec’s toDOM() to be asynchronous (let it return a Promise).

Use case

Let’s say we let authors to link not just to any web page, but to specific entities, such as books (or ISO standards, etc.).

At first approach, it seems like an elegant solution if we could keep links in source document structure as standardized object identifiers (e.g., urn:isbn:...), rather than freeform URLs.

At document generation stage, we’d then fetch the metadata about respective entities, and render them as <a> links (probably with some configurable extra markup like an icon, etc.).

For that purpose we’d use a third-party library that communicates with some registry in order to fetch entity’s metadata (e.g., title and stage for ISO standards), as well as its canonical URL. However, that involves a network request and would have to be asynchronous.

I don’t know whether this at all aligns with the spirit of ProseMirror, and/or whether there is a more appropriate way of achieving similar functionality that I should look into—would appreciate any pointers.

closed time in 10 days

strogonoff

issue commentProseMirror/prosemirror

Allow asynchronous toDOM()?

This would hugely complicate a lot of things, and generally require us to make a big part of the interface that's currently synchronous async. So no, it's not going to happen.

strogonoff

comment created time in 10 days

issue closedcodemirror/codemirror.next

CommonJS is not supported, it makes the lib unable to be imported in React (if a test exists)

Hello,

Context

I wanted to start using codemirror on a project written in React + TypeScript. Then I saw codemirror.next so I finally opted for it.

I started to draft some code around it to have it working fine and it works as charm. Then time to come to add some simple tests (in node + jest) to make sure that my code worked fine (mostly some kind of rendering the component and interacting with it).

Problem

But surprise whenever I try to import a file that directly or indirectly import codemirror I get error in my tests. Here is the error I get:

    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { NodeProp } from 'lezer-tree';
                                                                                             ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      1 | import React from 'react';
    > 2 | import { highlighter } from "@codemirror/next/highlight";

Here are for small repros of the issue: https://github.com/dubzzz/codemirror-next-repro-cra (one with basic CRA, one with default Jest setup in CommonJS and one with Jest setupt for esm).

Possible fixes?

While digging a little bit I saw that some packages were only built for type: module which might certainly be the origin of the problem.

Would you mind if me or someone else add support for commonjs in the library? I personally had to do this kind of stuff for my library fast-check and I recently saw that ramda also does that.

Regards, Nicolas

closed time in 10 days

dubzzz

issue commentcodemirror/codemirror.next

CommonJS is not supported, it makes the lib unable to be imported in React (if a test exists)

Oh, err, right. I've released a new version without this problem. (Whatever you do, don't look a at the relevant patch, or you might lose faith in my software.)

dubzzz

comment created time in 10 days

created tagmarijnh/style-mod

tag3.0.1

created time in 10 days

push eventmarijnh/style-mod

Marijn Haverbeke

commit sha 681630b7f4d5bff123197bdd2551b7477fd235eb

Fix horrendously fragile sed-based module system conversion See https://github.com/codemirror/codemirror.next/issues/310

view details

Marijn Haverbeke

commit sha cf4072399ece21ec1bc496956baad287c950dc86

Mark version 3.0.1

view details

push time in 10 days

push eventcodemirror/CodeMirror

Marijn Haverbeke

commit sha 55d0333907117c9231ffdf555ae8824705993bbb

[javascript mode] Fix potentially-exponential regexp

view details

push time in 10 days

push eventcodemirror/CodeMirror

Marijn Haverbeke

commit sha cdb228ac736369c685865b122b736cd0d397836c

Fix horizontal scrolling-into-view with non-fixed gutters Closes #6436

view details

push time in 10 days

issue closedcodemirror/CodeMirror

Horizontal scrolling not working properly with fixedGutter option set to false

With fixedGutter:false

  1. On pressing end button in a line , the cursor moves to the end of the line but scrollbar does not catch up. We have to drag the scrollbar to the end to see the rightmost text.
  2. Same thing happens when we type anything at the end of the line.

But with fixedGutter:true scrolling works properly.

var myCodeMirror = CodeMirror(document.getElementById('editor'), {
  value: "function myScript(){console.log(\"100\");}\nconsole.log(\"test test test test test test test test 

test test test test test test test test test test test test test test test test test test test test test test 

test test test test test test\");\n\n\n\n\n\n\n\n\n\n\n\n\n",
  mode:  "javascript",
  lineNumbers: true,
  fixedGutter: false,
});

ezgif com-gif-maker

closed time in 10 days

sagar-joshi

issue commentcodemirror/codemirror.next

CommonJS is not supported, it makes the lib unable to be imported in React (if a test exists)

Would you mind if me or someone else add support for commonjs in the library?

I'd rather not, at this point. Tools are increasingly moving to ES modules, and I'd like to leave the confusing multiple-module-systems situation behind me as soon as possible. Your description of the situation suggests that your test runner doesn't understand ES modules yet (or hasn't been configured to). You didn't mention which test runner you're using, but I know recent versions of Mocha (when running on node 13+) can handle this.

dubzzz

comment created time in 10 days

pull request commentProseMirror/website

Fix typos

Thanks!

cindywu

comment created time in 10 days

push eventProseMirror/website

cindy

commit sha 529f44a4f0caa5717d6118e90c4a5fce2f7cb44a

Fix typos

view details

push time in 10 days

PR merged ProseMirror/website

Fix typos

🍰

+2 -2

0 comment

2 changed files

cindywu

pr closed time in 10 days

issue closedcodemirror/CodeMirror

The editor under vue3 inserts the last line, cannot enter

the platform is win10

Report an error

codemirror.js:1659 Uncaught TypeError: Cannot read property 'height' of undefined at lineLength (codemirror.js:1659) at codemirror.js:5454 at LeafChunk.iterN (codemirror.js:5618) at Doc.iterN (codemirror.js:5720) at Doc.iter (codemirror.js:6106) at makeChangeSingleDocInEditor (codemirror.js:5453) at makeChangeSingleDoc (codemirror.js:5423) at makeChangeInner (codemirror.js:5292) at makeChange (codemirror.js:5283) at applyTextInput (codemirror.js:8139)

the main code for bug

 insertContent(str){
       editor?.value.replaceSelection(str);
       lastInsert.value = str.replace(/\n/g, ""); //保存上一次插入的内容,去掉空格 这个功能用于 列表等操作按回车自增
     },
insertTitle(level) {// 插入标题
      const titles = {
        1: "#  ",
        2: "##  ",
        3: "###  ",
        4: "####  ",
        5: "#####  ",
        6: "######  "
      };
      const {line} = lastPos;
      const selection = editor?.value.getSelection();
      if (selection) {
        actions.insertContent("\n" + titles[level] + selection + "\n");
        return
      } else {
        const title = titles[level];
        if ( editor?.value.isClean()) {  //判断是否是空文档 特殊处理
          actions.insertContent(title+"\n ");
          setCursor(0,title.length)
          return;
        } else {
          actions.insertContent("\n" + title+"\n ");
          setCursor(line + 1,title.length)
          return;
        }
      }
    },

image

 let title=[
    {
      "tip":"标题1",
      "name":"h1",
      "action":()=>{
        action.insertTitle(1)}
    },
    {
      "tip":"标题2",
      "name":"h2",
      "action":()=>{action.insertTitle(2)}
    },...
function renderList(data) {
  return data.map((item)=>{
    // @ts-ignore
    return ( <li  name={item.tip} >
      <WIcon  name={item.name}  class="iconfont" onClick={item.action}></WIcon>
    </li>)
  })
}

the step one click h1 the step two click h2 the step three add content at last line the bug is can't input things and if click other button the content will insert

the project git is https://github.com/wike2019/wike-ui

closed time in 10 days

wike2019

issue commentcodemirror/CodeMirror

The editor under vue3 inserts the last line, cannot enter

Debugging this, it looks like you're calling CodeMirror methods on some Vue-related Proxy, not the actual editor object. This further wraps stuff returned by its methods in Proxy objects, which breaks stuff down the line. I'm not familiar with the magic Vue is performing here, but I think you'll get a lot further if you just avoid wrapping the editor in it.

wike2019

comment created time in 10 days

issue closedcodemirror/CodeMirror

vue3下编辑器插入 最后一行,无法输入

报错 codemirror.js:1659 Uncaught TypeError: Cannot read property 'height' of undefined at lineLength (codemirror.js:1659) at codemirror.js:5454 at LeafChunk.iterN (codemirror.js:5618) at Doc.iterN (codemirror.js:5720) at Doc.iter (codemirror.js:6106) at makeChangeSingleDocInEditor (codemirror.js:5453) at makeChangeSingleDoc (codemirror.js:5423) at makeChangeInner (codemirror.js:5292) at makeChange (codemirror.js:5283) at applyTextInput (codemirror.js:8139)

操作步骤 先点击h1 插入一个标题 然后再点击 h2插入一个标题 最后一行输入 输入无效果,

项目参考 https://github.com/wike2019/wike-ui 直接 npm install npm run dev 就可以启动

closed time in 11 days

wike2019

issue commentcodemirror/CodeMirror

The editor under vue3 inserts the last line, cannot enter

In the other issue, I also asked you to reduce this to a minimal script that shows the problem. I'm not prepared to debug a non-trivial app like the one you linked.

wike2019

comment created time in 11 days

issue commentcodemirror/CodeMirror

vue3下编辑器插入 最后一行,无法输入

If you can reduce the problem to a script of a few lines, I can take a look. But this project is maintained in English, so you'll at least have to make the effort to run your text through a translator if you want me to look at it.

wike2019

comment created time in 11 days

push eventmarijnh/builddocs

Marijn Haverbeke

commit sha 2e17449f2852e90daaebf58abdcda29515933a6c

Stop emitting 'readonly' Since it suggests that all other properties are writable, which is usually not correct.

view details

push time in 11 days

issue closedcodemirror/CodeMirror

Rotated/vertical text

Hi code-mirror experts!

I was wondering if it's possible for code-mirror to display vertical/rotated text. Specifically, I think it would be nice to make use of indentation space.

class Bar {
------- VISIBLE SCREEN AREA
{ function bar() {
r   var z = 1;
a   var y = 2;
B   Var x = 3;
    return 1;
s }
s
a function foo() {
l   return 2;
c }
------- VISIBLE SCREEN AREA

In this case, because the view does not see class Bar{, we show class Bar { in the indentation space.

It would be nice if the vertical text could have the characters rotated 90 degrees so that it's easier to read.

I don't know how the engine works, but I'm very interested to help contribute such a feature or plugin.

Thank you,

kovkev

closed time in 11 days

kovkev

issue commentcodemirror/CodeMirror

Rotated/vertical text

It should be possible to write an extension that does this, by overlaying the individual letters over the content in the right place, but the core library doesn't help much there (and won't—this is out of scope for the library itself, and would have to be implemented in a separate package).

kovkev

comment created time in 11 days

push eventmarijnh/blog

Marijn Haverbeke

commit sha 07afb14032cbe6b66dc1610026391116e2a526f5

Fix stray word in extensibility entry

view details

push time in 12 days

issue commentcodemirror/codemirror.next

get Subtree through iteration

(As a note, I'm working on overhauling the tree iteration interface to be a bit more flexible, using an external iterator (stateful object instead of method that calls a callback). That'll make it a lot easier to get a subtree at a given iteration position.)

Nexucis

comment created time in 12 days

pull request commentcodemirror/CodeMirror

fix focus/blur issues during editing

ensureFocus is also used in another context and changing its behavior like this doesn't look safe.

Patch c0b371cf5 suggests that synchronously focusing at this point is a problem, hence the timeout in the existing code. I don't think it's a good idea to start doing that again (and it doesn't seem necessary—you could lift the if (cm.state.focused) into leftButtonDown and run the old behavior if the editor isn't already focused).

rPraml

comment created time in 13 days

PR closed ProseMirror/website

improved docs
+1 -1

1 comment

1 changed file

himani09212

pr closed time in 13 days

pull request commentProseMirror/website

improved docs

They changed the rules, you don't get a t-shirt anymore for spamming. So stop. Or maybe you shouldn't have started in the first place.

himani09212

comment created time in 13 days

issue commentProseMirror/prosemirror

Adding inline decoration around selection from click handler outside editor causes incorrect DOM selection

Another workaround would be to clear the DOM selection (getSelection().removeAllRanges()).

I found that this change fixes the problem.

Sure, but it'll introduce different problems where the editor messes with the DOM selection in situations where it shouldn't.

hedgepigdaniel

comment created time in 13 days

issue commentcodemirror/google-modes

[go] imported package name that coincides with a keyword gets highlighted like a keyword.

Does the language allow this for proper keywords as well, or does the problem only exist for what the mode marks as 'builtin' words? I.e. could you import something named func or var and use it this way? (I'm not familiar enough with Go to quickly try this out.)

Attached patch address this for builtins, which includes print.

takamori

comment created time in 13 days

push eventcodemirror/google-modes

Marijn Haverbeke

commit sha 7b573f36e9f2aa4aab13c52de0d9615f9097e114

[go mode] Don't treat identifiers followed by a dot as builtins Issue #319

view details

push time in 13 days

pull request commentacornjs/acorn

Added power support

I have never ran into a situation where a node.js program worked on one architecture but not on another, so at first glance, this looks like a waste of Travis CPU time. Can you elaborate on the motivation here?

dthadi3

comment created time in 13 days

push eventcodemirror/codemirror.next

Marijn Haverbeke

commit sha c7b52fefdfe0091e5dc74007d24b5b02325969c0

Some provisional fixes to the one-dark theme

view details

push time in 14 days

pull request commentcodemirror/codemirror.next

Fix incorrect style selector for wrap

Oh, seems like there's a bunch of precedence issues with the them (and theming in general) as well. Opened #309 for that.

PhilippRaab

comment created time in 14 days

issue openedcodemirror/codemirror.next

Theme style precedence is hard to manage

With 9fa3bcafd0fc82, themes can use more complicated selectors—which was often necessary—but that makes them subject to CSS's own precedence behavior again, which can be awkward and hard to predict. For example, the base theme defines a style for $$focused $cursor (.ID.cm-focused.cm-light .cm-cursor), and a theme that just styles $cursor, which would be a reasonable thing to do, will simply be overridden by the default cursor color.

I'd be nice if real themes always override rules from base themes, but CSS doesn't have a good way to express that. Not sure how, short of adding a bunch of bogus classes to boost rules' precedence, to address this.

created time in 14 days

pull request commentcodemirror/codemirror.next

Fix incorrect style selector for wrap

Thanks!

PhilippRaab

comment created time in 14 days

push eventcodemirror/codemirror.next

Philipp Raab

commit sha edcb668a243c48905f879af9f6651db86e0532f2

Fix incorrect style selector for wrap

view details

push time in 14 days

more