Skip to content

Wrong folding and indentation in code snippet that doesn't to a Class {} #8

@sct999

Description

@sct999

I have created a CodeMirror editor using the csharp() extension.

The code editor is created as follows

const state = EditorState.create({
      doc: '',
      extensions: [basicSetup, csharp()],
});

const editorElement = document.getElementById('code-editor');
this.editorView = new EditorView({ state, parent: editorElement });

The code I'm trying to edit in codemirror is this

NewValue = AtmPressure * 0.21 + 5.5;
Temperature = (-0.2 * AtmPressure * AtmPressure + 2.4 * AtmPressure - 23.6873);
Pressure = (0.2 * AtmPressure * AtmPressure - 2.3061 * AtmPressure + 2.3);
  Flow = (0.2 * AtmPressure * AtmPressure - 3.5 * AtmPressure + 5.3);
  Revenue = (-0.0043 * AtmPressure * AtmPressure + 1.5 * AtmPressure + 2.3);

And it looks like this
image

It detects line 3 onwards as foldable, however, that's not correct.

Can this extension support code snippets that don't explicitly belong to a parent class?
Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions