项目作者: sri

项目描述 :
VSCode plugin to share the selected code to JIRA & Slack
高级语言: TypeScript
项目地址: git://github.com/sri/share-selected-code.git
创建时间: 2018-08-16T08:33:22Z
项目社区:https://github.com/sri/share-selected-code

开源协议:MIT License

下载


Share Selected Code

This VSCode extension helps you share your code to sites like JIRA and Slack.
It formats the selected code according to the site’s style.

Here is an example for JIRA:

1) If this is the code that you have selected in your VSCode window

  1. selectByWholeLines(selection: vscode.Selection) {
  2. const newStart = new vscode.Position(selection.start.line, 0);
  3. const newEnd = (selection.end.character === 0) ?
  4. selection.end :
  5. new vscode.Position(selection.end.line + 1, 0);
  6. return new vscode.Selection(newStart, newEnd);
  7. }

2) And you invoke “Share Selected Code for JIRA” command, this will what be copied to your clipboard:

  1. *share-selected-code/src/selection.ts*:
  2. {noformat}
  3. 17 selectByWholeLines(selection: vscode.Selection) {
  4. 18 const newStart = new vscode.Position(selection.start.line, 0);
  5. 19 const newEnd = (selection.end.character === 0) ?
  6. 20 selection.end :
  7. 21 new vscode.Position(selection.end.line + 1, 0);
  8. 22
  9. 23 return new vscode.Selection(newStart, newEnd);
  10. 24 }
  11. {noformat}

3) And here is how it’ll look when posted to JIRA:

Screenshot of the above in JIRA:

JIRA Screenshot

Features

  • Currently supports: JIRA and Slack
  • Includes line numbers
  • Include the path to the file, relative to the repo path
  • Handles multiple selections correctly

Requirements

This has been tested on Visual Studio Code 1.26.0.

Extension Settings

There are currently two commands:

Share Selected Code to Slack: extension.shareSelectedCode.slack

Share Selected Code to JIRA: extension.shareSelectedCode.jira

Enjoy!!