Skip to content

Commit

Permalink
Added feature to auto detect the OS end-of-line (EOL) character.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohit Bhati committed Sep 3, 2024
1 parent f451f89 commit 9fa0e3b
Show file tree
Hide file tree
Showing 8 changed files with 851 additions and 760 deletions.
Binary file modified docs/en_US/images/query_status_bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
465 changes: 234 additions & 231 deletions docs/en_US/query_tool_toolbar.rst

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { errorMarkerEffect } from './extensions/errorMarker';
import { currentQueryHighlighterEffect } from './extensions/currentQueryHighlighter';
import { activeLineEffect, activeLineField } from './extensions/activeLineMarker';
import { clearBreakpoints, hasBreakpoint, toggleBreakpoint } from './extensions/breakpointGutter';
import { autoCompleteCompartment } from './extensions/extraStates';
import { autoCompleteCompartment, eol, eolCompartment } from './extensions/extraStates';


function getAutocompLoading({ bottom, left }, dom) {
Expand All @@ -30,11 +30,13 @@ export default class CustomEditorView extends EditorView {
this._cleanDoc = this.state.doc;
}

getValue(tillCursor=false) {
getValue(tillCursor=false, lineSep=false) {
if(tillCursor) {
return this.state.sliceDoc(0, this.state.selection.main.head);
} else if (lineSep) {
return this.state.doc.sliceString(0, this.state.doc.length, lineSep);
}
return this.state.doc.toString();
return this.state.sliceDoc();
}

/* Function to extract query based on position passed */
Expand Down Expand Up @@ -328,4 +330,14 @@ export default class CustomEditorView extends EditorView {
setQueryHighlightMark(from,to) {
this.dispatch({ effects: currentQueryHighlighterEffect.of({ from, to }) });
}

getEOL(){
return this.state.facet(eol);
}

setEOL(val){
this.dispatch({
effects: eolCompartment.reconfigure(eol.of(val))
});
}
}
Loading

0 comments on commit 9fa0e3b

Please sign in to comment.