-
Notifications
You must be signed in to change notification settings - Fork 16
Home
t9md edited this page Mar 1, 2017
·
24 revisions
-
narrow-provider
: Provide items to narrow and action to jump to item selected. -
narrow-ui
: in most case, it meansnarrow-editor
.- handles user input and update item list.
- manage
narrow-editor
andcontrol-bar
, syntax highlight grammar.
-
narrow-editor
: text-editor where items are rendered and where you input narrow-query.
- Provider provides items( collection of item ).
- Basically all provider has to provide item which is openable as text file.
- e.g. Executing command by narrowing command list by
narrow-ui
is out of scope ofnarrow
. - Item has to have
point
field. - If provider is not bound to single file, item also must have
filePath
field.
- e.g. Executing command by narrowing command list by
- Two kind of provider
- boundToSingleFile provider: e.g.
scan
,fold
,symbols
.- Not show project and file header( since all items are from single file ).
- Basically, this provider can detect non-saved change, and refresh items on did change buffer content.
-
symbols
provider is exceptional, cannot detect change, need to save to make items up-to-date.
-
- Not boundToSingleFile provider: e.g.
search
,atom-scan
,git-diff-all
.- Shows project and file header.
- Basically, this provider can not detect non-saved change, and refresh items on buffer saved.
- boundToSingleFile provider: e.g.
- Provider have corresponding, dedicated
narrow-ui
, in other wordnarrow-ui
is not shared by multiple provider. -
narrow-ui
is always bound to current active editor.- And sync cursor position of active-editor with items on
narrow-editor
.
- And sync cursor position of active-editor with items on
-
narrow-editor
must be normal text-editor.- To edit and move cursor exactly same manner as other text-editor.
- e.g. Must be abled to use vim-mode-plus in
narrow-editor
. - I tried different approaches multiple times and failed.
- Now learned this "must be normal text editor" is most prioritized from UX standpoint.
- User invoke
narrow:scan
- Instantiate
Scan
provider and instantiateUi
to use for this provider. - Open
narrow-editor
(Ui
holdnarrow-editor
andcontrol-bar
etc..).
- Used to filter items on
narrow-editor
. - You can input query on first line of
narrow-editor
. - Basically query is matched as-is( No regular expression support currently ).
- Can chain multiple query separating by
whilte-space
.- e.g.
foo bar
means, select items matchesfoo
andbar
.
- e.g.
-
*
is treated as wildcard, internally converted to.*
regular expression.- To search
*
itself, use*
solely separate it by space. - Or use double
**
. ( e.g. To match to string*hello
use**hello
as query).
- To search
-
!
is treated as negate,!foo
means 'not matchingfoo
'.- If config
negateNarrowQueryByEndingExclamation
set totrue
, you can also usefoo!
.
- If config
- Query case sensitivity is configurable with config
caseSensitivityForNarrowQuery
.- Can override global setting on each provider if you want.
- See also this issue
- Scan current editor( use
editor.scan
under the hood ) - It use first narrow query as search term( first word separated by white-spaces on query text ).
- Rest of include and exclude(
!
starting word) queries are treated as normal filter query. - To make this exceptional query handling obvious by eye, use different syntax grammar highlight for first query(= scan term).
- Search by
ag
( you need to installag
by yourself). - Need to install ag by yourself.
- Similar to
search
but use Atom'satom.workspace.scan
.
- Provide fold-starting rows as item.
- Can change fold level to show up on
narrow-editor
bynarrow-ui:fold:increase-fold-level
narrow-ui:fold:decrease-fold-level
- Show
git-diff
for current active-editor. Info source is coregit-diff
package.
- Show all modified state file across project.
- If you are comfortable with this provider, you don't need
git-diff
at all( like me ).
- Info source is core
bookmarks
package - This is toy, I don't use
bookmarks
feature heavily.
- Provide symbols for current file.
- Useful to quick previewing function definition on same file.
- Provide project-wide symbols information by reading
tags
file.
- Use message provided by linter package.
- Possible value and short descriptions are here.
-
inherit
: pick global setting. -
right
: default, no behavior change -
right:never-use-previous-adjacent-pane
: don't use previous adjacent pane( use only next adjacent ) -
right:always-new-pane
: -
down
: -
down:never-use-previous-adjacent-pane
: -
down:always-new-pane
:
-
- When
true
,foo!
means "not matching foo" as like!foo
means that. - Only
select-files
provider enabled by default. ( To excludemd
file bymd!
).- This is better than
!md
keystroke. - Since user can confirm which files are excluded.
- At the timing when query become
md
and before adding ending!
.
- This is better than
- When you move cursor on
narrow-editor
, item under cursor is automatically opened to preview.
- When you input query and items on
narrow-editor
re-rendered, auto-preview first item.
- When
true
, closenarrow-editor
on confirmed byenter
. - Set to
false
if you want keepnarrow-editor
open after confirmation.- Or you can use
narrow-ui:confirm-keep-open
as alternative.
- Or you can use
Reveal closest item at startup.
- Value can be
-
never
: Never reveal -
always
: Always try to reveal -
on-input
: Reveal when initial query was provided via-by-current-word
commands.
-
- Each provider have different default value( opinionated ). So no global default.
- Basic strategy to choose default value is below.
- boundToSingleFile provider(
scan
,fold
,symbols
) haveon-input
default - Other have
always
default(search
,atom-scan
,git-diff-all
).
- boundToSingleFile provider(
- Basic strategy to choose default value is below.