Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  index.js

  Sprache: JAVA
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */


export * from "./source-search";
export * from "../ui";
export * from "./tokens";

import { createEditor } from "./create-editor";

let editor;

export function getEditor() {
  if (editor) {
    return editor;
  }

  editor = createEditor({ cm6: true });
  return editor;
}

export function removeEditor() {
  editor = null;
}

/**
 *  Update line wrapping for the codemirror editor.
 */

export function updateEditorLineWrapping(value) {
  if (!editor) {
    return;
  }
  editor.setLineWrapping(value);
}

export function toWasmSourceLine(offset) {
  return editor.wasmOffsetToLine(offset) || 0;
}

/**
 * Convert source lines / WASM line offsets to Codemirror lines
 *
 * @param {object} source
 * @param {number} lineOrOffset
 * @returns
 */

export function toEditorLine(source, lineOrOffset) {
  if (editor.isWasm && !source.isOriginal) {
    // TODO ensure offset is always "mappable" to edit line.
    return toWasmSourceLine(lineOrOffset) + 1;
  }
  return lineOrOffset;
}

export function fromEditorLine(source, line) {
  // Also ignore the original source related to the .wasm file.
  if (editor.isWasm && !source.isOriginal) {
    // Content lines is 1-based in CM6 and 0-based in WASM
    return editor.lineToWasmOffset(line - 1);
  }
  return line;
}

export function toEditorPosition(location) {
  // Note that Spidermonkey, Debugger frontend and CodeMirror are all consistent regarding column
  // and are 0-based. But only CodeMirror consider the line to be 0-based while the two others
  // consider lines to be 1-based.
  const isSourceWasm = editor.isWasm && !location.source.isOriginal;
  return {
    line: toEditorLine(location.source, location.line),
    column: isSourceWasm || !location.column ? 0 : location.column,
  };
}

export function toSourceLine(source, line) {
  if (editor.isWasm && !source.isOriginal) {
    return editor.lineToWasmOffset(line - 1);
  }
  return line;
}

Messung V0.5 in Prozent
C=90 H=100 G=95

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=434850
#Domains=655579