LoginSignup
20
13

More than 5 years have passed since last update.

Atomでプロジェクト検索結果をクリップボードにコピーする方法

Last updated at Posted at 2017-12-14

まずは、普通に[Shit+⌘+F]で検索します。

image.png

次に[Option+⌘+I]でDeveloper Toolを開き、そこのConsoleで以下を実行します。

pack = atom.packages.getActivePackage('find-and-replace');
results = pack.mainModule.resultsModel.results;
hoge = Object.values(results).map((result) => { return {filePath: result.filePath, matches: result.matches.map((match) => { return match.lineText })} });
copy(hoge);

image.png

クリップボードに以下のようにコピーされます。

[
  {
    "filePath": "/Users/you/Projects/hoge/app/controllers/api/api_controller.rb",
    "matches": [
      "class Api::ApiController < ApplicationController"
    ]
  },
  {
    "filePath": "/Users/you/Projects/hoge/app/controllers/api/bills_controller.rb",
    "matches": [
      "class Api::BillsController < Api::ApiController"
    ]
  },
  {
    "filePath": "/Users/you/Projects/hoge/app/controllers/api/clients_controller.rb",
    "matches": [
      "class Api::ClientsController < Api::ApiController"
    ]
  },
  ...
]

以上です。

20
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
13