当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript DisplayMarkerLayer.findMarkers方法代码示例

本文整理汇总了TypeScript中atom.DisplayMarkerLayer.findMarkers方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DisplayMarkerLayer.findMarkers方法的具体用法?TypeScript DisplayMarkerLayer.findMarkers怎么用?TypeScript DisplayMarkerLayer.findMarkers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在atom.DisplayMarkerLayer的用法示例。


在下文中一共展示了DisplayMarkerLayer.findMarkers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: findIssueTags

 editor.onDidStopChanging(event_editorchanged => {
   // event_editorchanged.changes.forEach(text_change => {
   for (var text_change of event_editorchanged.changes) {
     // console.log('Deleted: "' + text_change.oldText + '"');
     // console.log('Added: "' + text_change.newText + '"');
     // check if the change range is in any of our issue tags.
     if (
       text_change.newText.length > 0 || // if text was added, we need to rescan
       issuetaglayer.findMarkers({
         intersectsBufferRange: text_change.oldRange
       }).length > 0
     ) {
       // then we should re-scan
       console.log("Re-scanning for issue tags...");
       findIssueTags(editor, issuetaglayer);
       break;
     }
     // else {
     //   // no need to re-scan
     //   console.log("No need to re-scan change: " + text_change.oldRange);
     // }
   } //);
 })
开发者ID:utk-cs,项目名称:team-minsky,代码行数:23,代码来源:minskylink.ts

示例2: parseInt

 textToSearch.scan(regex1_gh, scanResult => {
   var issue_number: number = parseInt(scanResult.match[1]);
   // console.log("Found issue tag: " + scanResult.matchText);
   // check if there already exists a marker on this layer:
   var existing_markers = issuetaglayer.findMarkers({
     intersectsBufferRange: scanResult.range
   });
   for (var marker_to_check of existing_markers) {
     if (marker_to_check.isValid() == true) {
       // still is valid? don't bother
       // console.log(
       //   "Issue tag #" +
       //     issue_number +
       //     " already known: " +
       //     marker_to_check.getBufferRange()
       // );
       return;
     } else {
       // destroy the invalid marker:
       marker_to_check.destroy();
     }
   }
   // console.log("Creating marker on " + scanResult.range);
   var new_marker = issuetaglayer.markBufferRange(scanResult.range, {
     invalidate: "touch"
   });
   new_marker.setProperties({
     minsky: issue_number
   });
   console.log(
     "Created marker for issue #" +
       issue_number +
       ": " +
       new_marker.getStartBufferPosition
   );
 });
开发者ID:utk-cs,项目名称:team-minsky,代码行数:36,代码来源:minskylink.ts

示例3: openIssueishFromCursorPosition

export function openIssueishFromCursorPosition(): void {
  var current_editor = atom.workspace.getActiveTextEditor();

  if (current_editor == undefined) {
    console.log("No editor in focus.");
    atom.notifications.addError("Minsky Link: No editor in focus!", {
      description: "Please focus a text editor pane and tag, then try again.",
      dismissable: true
    });
    return;
  }
  if (current_editor.hasMultipleCursors()) {
    console.log("Dunno how to handle hasMultipleCursors!");
    atom.notifications.addError("Minsky Link cannot handle multiple cursors!", {
      description: "This may later be implemented.",
      dismissable: true
    });
    return;
  }

  var current_minsky_marker_layer:
    | DisplayMarkerLayer
    | undefined = current_editor.getMarkerLayer(
    map_TextEditors_DisplayMarkerLayerIds[current_editor.id]
  );
  if (current_minsky_marker_layer == undefined) {
    console.log("Could not retrieve the marker layer!");
    atom.notifications.addFatalError(
      "Minsky Link encountered an unknown error.",
      {
        description: "Error: undefined current_minsky_marker_layer",
        dismissable: true
      }
    );
    return;
  }

  var current_cursor = current_editor.getLastCursor();
  console.log("Current cursor position: " + current_cursor.getBufferPosition());

  var potential_markers: DisplayMarker[] = current_minsky_marker_layer.findMarkers(
    {
      containsBufferPosition: current_cursor.getBufferPosition()
    }
  );

  console.log("Found " + potential_markers.length + " potential_markers");

  var target_marker: DisplayMarker | undefined;
  for (var potential_marker of potential_markers) {
    console.log(
      "potential_marker has properties " +
        Object.keys(potential_marker.getProperties())
    );
    if (potential_marker.getProperties().hasOwnProperty("minsky")) {
      target_marker = potential_marker;
      break;
    }
  }
  if (target_marker == undefined) {
    console.log("No minsky-link markers found under the cursor.");
    atom.notifications.addWarning("Couldn't parse tag.", {
      detail:
        "Please place the text cursor on the issue tag and try again.\n\
You may need to change the Issue Tag Regex in the plugin settings if your tags are not being recognized.",
      dismissable: false
    });
    return;
  }

  console.log("Found issue under cursor: " + target_marker.getBufferRange());

  var target_properties = target_marker.getProperties() as any;
  console.log("Lookup issue #" + target_properties["minsky"]);

  var loading_notif = atom.notifications.addSuccess(
    "Minsky-Link: Loading Issue #" + target_properties["minsky"],
    {
      description: "Opening pane for issue #" + target_properties["minsky"],
      dismissable: false // will disappear on it's own
    }
  );

  // XXX new idea: hijack github views
  // for now since GH84 is in the way, let's just assume it's here

  var reposlug = getRepoNames();

  var current_repo = atom.project.getRepositories()[0];
  var git_workdir = current_repo.getWorkingDirectory();

  var new_uri_to_open =
    "atom-github://issueish/" +
    encodeURIComponent("https://api.github.com") +
    "/" +
    reposlug[0] +
    "/" +
    reposlug[1] +
    "/" +
    target_properties["minsky"] +
//.........这里部分代码省略.........
开发者ID:utk-cs,项目名称:team-minsky,代码行数:101,代码来源:minskylink.ts


注:本文中的atom.DisplayMarkerLayer.findMarkers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。