Skip to content

UseCase

t9md edited this page Mar 5, 2017 · 6 revisions

Remove unused function.

remove-unused-function

By search whole projects, you can remove unused functions with confidence.
You don't have to use your brain, just repeat following steps.

  1. search
  2. remove unused function and save
  3. hit tab( narrow:next-item ).
  4. repeat step 1-3 until items on narrow-editor get emptied.

Quick previewing

quick-preview

  1. Start narrow:scan-by-current-word.
  2. Check how that term is used in current file.
  3. Closing narrow-editor by ctrl-g recover original cursor position/screen-top/fold.

Direct edit multiple line

Provider: scan, search, atom-scan

direct-edit-by-scan

  1. Start narrow:scan and input query.
  2. Move to item area, and edit-it.
  3. Invoke narrow-ui:update-real-file from command palette or from keymap.
  4. Changes you made is applied to real file.

Navigate to point of interest

  1. Open narrow:fold, narrow:search
  2. Confirm first matching item, now focus is on original-pane.
  3. next-item, previous-item guide cursor to next/previous point of interest.
  4. As you move to next/previous-item, or any cursor movement/pane-item change reflect current-selected-item indicator on narrow-editor, this will give user "where am I info".
  • Keep track of current position within items is really important.
  • next-item then move cursor to different position by mouse-clicking/or via normal-atom-command then next-item SHOULD move to next-item which is relative to CURRENT cursor position.
  • Unless auto-tracking, next-item can be move-BACK cursor, this is not what user expect. narrow-editor must aware of position/buffer change of bound-editor.

As minimap-like

minimap-like

  1. Open narrow:fold or narrow:symbols
  2. Move this narrow-editor to rightmost or leftmost position in workspace, so that you can see it in comfortable place.
  3. Each time you focused to different file, symbols(or fold) items are updated.
  4. For fold, you can change fold level by cmd-[, cmd-] in narrow-editor to control granularity level of information.
  5. Yes you can use this as minimap which clickable and shows only important information only.
  6. Further, you can narrow the focus by query.
  • e.g. in file which file contains multiple classes and some of it have initialize overriding,
  • In this case, narrowing by initialize query, show only initialize functions in the items.

As TODO list

search-FIXME

  1. Place cursor the [TODO] or [FIXME] keyword, then open narrow:search-by-current-word.
  2. Confirm first matching item, now focus is on original-pane.
  3. next-item, previous-item guide cursor to next/previous point of interest.
  4. After you fixed it and removed [FIXME] or [TODO] keyword and saved. items are auto-refreshed.
  5. So remaining items in narrow-editor is [TODO]s you have to done.
  6. When you done all the [TODO]s or [FIXME]s narrow-editor would have no items in the list. DONE.

As this way, you can use this approach when you

  • Rename variable names in project
  • Changing argument for particular function(e.g from string argument to object).
  • Removing deprecated code(after spending enough migration period and now it's time to delete!).

You can concentrate updating code and save then move to next by next-item(ctrl-cmd-n or tab for vim-mode-plus user).

As TOC( table-of-content )

toc

Open Of course, clickable, narrowable.

  1. Open narrow:symbols, narrow:search, narrow:fold, narrow item by query if necessary.
  2. Click item listed cause auto-preview.

In this scenario, narrow is like minimap which gives overview of code with readable text(in minimap it's gives pictorial overview but text is not readable)