How to use the codemirror-promql/complete.newCompleteStrategy function in codemirror-promql

To help you get started, we’ve selected a few codemirror-promql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github prometheus / prometheus / web / ui / react-app / src / pages / graph / CMExpressionInput.tsx View on Github external
useEffect(() => {
    // Build the dynamic part of the config.
    promqlExtension
      .activateCompletion(enableAutocomplete)
      .activateLinter(enableLinter)
      .setComplete({
        completeStrategy: new HistoryCompleteStrategy(
          newCompleteStrategy({
            remote: { url: pathPrefix },
          }),
          queryHistory
        ),
      });
    const dynamicConfig = [enableHighlighting ? promqlHighlighter : [], promqlExtension.asExtension()];

    // Create or reconfigure the editor.
    const view = viewRef.current;
    if (view === null) {
      // If the editor does not exist yet, create it.
      if (!containerRef.current) {
        throw new Error('expected CodeMirror container element to exist');
      }

      const startState = EditorState.create({

codemirror-promql

a CodeMirror mode for the PromQL language

Apache-2.0
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis