-
Notifications
You must be signed in to change notification settings - Fork 12
UseCase
t9md edited this page Mar 5, 2017
·
6 revisions
- Remove unused function.
- Quick previewing
- Direct edit multiple line
- Navigate to point of interest
- As minimap-like
- As TODO list
- As TOC( table-of-content )
By search
whole projects, you can remove unused functions with confidence.
You don't have to use your brain, just repeat following steps.
- search
- remove unused function and save
- hit
tab
(narrow:next-item
). - repeat step 1-3 until items on
narrow-editor
get emptied.
- Start
narrow:scan-by-current-word
. - Check how that term is used in current file.
- Closing
narrow-editor
byctrl-g
recover original cursor position/screen-top/fold.
Provider: scan
, search
, atom-scan
- Start
narrow:scan
and input query. - Move to item area, and edit-it.
- Invoke
narrow-ui:update-real-file
from command palette or from keymap. - Changes you made is applied to real file.
- Open
narrow:fold
,narrow:search
- Confirm first matching item, now focus is on original-pane.
-
next-item
,previous-item
guide cursor to next/previous point of interest. - 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 thennext-item
SHOULD move tonext-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.
- Open
narrow:fold
ornarrow:symbols
- Move this narrow-editor to rightmost or leftmost position in workspace, so that you can see it in comfortable place.
- Each time you focused to different file,
symbols
(orfold
) items are updated. - For
fold
, you can change fold level bycmd-[
,cmd-]
innarrow-editor
to control granularity level of information. - Yes you can use this as minimap which clickable and shows only important information only.
- 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 onlyinitialize
functions in the items.
- Place cursor the
[TODO]
or[FIXME]
keyword, then opennarrow:search-by-current-word
. - Confirm first matching item, now focus is on original-pane.
-
next-item
,previous-item
guide cursor to next/previous point of interest. - After you fixed it and removed
[FIXME]
or[TODO]
keyword and saved. items are auto-refreshed. - So remaining items in narrow-editor is
[TODO]
s you have to done. - 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).
Open Of course, clickable, narrowable.
- Open
narrow:symbols
,narrow:search
,narrow:fold
, narrow item by query if necessary. - 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)