Skip to content

Conversation

L3MON4D3
Copy link
Owner

No description provided.

@L3MON4D3
Copy link
Owner Author

Thank you for already taking a look @leiserfg :)
I think I'll throw the other changes ("jump index" everywhere) mentioned in #550 in here too.

@leiserfg
Copy link
Contributor

Maybe add a Notes section and there explain it and link it in the entries referring to it? So you don't have to put the same in several places?

@L3MON4D3
Copy link
Owner Author

Do you mean for explaining jump-index? Right, that's actually missing 😅
But I don't really get what's duplicated right now

@leiserfg
Copy link
Contributor

It is not, just if you will document the behaviour in other places you could just link it.

@L3MON4D3
Copy link
Owner Author

Makes sense 👍
I've though of doing something like that for the argnodes passed to function/dynamicNode, since they can be

  • just an integer for the jump-index
  • absolute_indexer
  • or even just a node
    (or, I guess just refer to them by a proper name as well.. maybe "node-reference")

@L3MON4D3
Copy link
Owner Author

Though that is a pretty big number of links.. But you're right, it will come in handy.
Maybe a glossary, preferably at the end?

@L3MON4D3 L3MON4D3 force-pushed the fmt_doc_improve branch 5 times, most recently from de00ef2 to 5266dd6 Compare August 31, 2022 22:57
@L3MON4D3
Copy link
Owner Author

I've opted for working the sections that explain those concepts into the text, feels more natural than a big glossary at the end IMO, but happy to hear reasons for doing it differently :D

@danielo515
Copy link

That sounds awesome!

@L3MON4D3
Copy link
Owner Author

L3MON4D3 commented Oct 7, 2022

Okay I think this is done, I'll hold off from merging until #612 is in, don't wanna complicate that.

I've though about turning list-entries in API-REFERENCE to subsections (+: can link directly to those, -: it's pretty unnecessary for short stuff, which is most of these), but don't think it's worth it

@L3MON4D3 L3MON4D3 force-pushed the fmt_doc_improve branch 2 times, most recently from b9cdc1d to ebd3060 Compare October 9, 2022 21:51
Previously, jump-index, position, jump-position were used
interchangibly.
Explain concept of node-references ([number/absolute_indexer/node]
passed to function/dynamicNodes).
Also, give more detailed reference for especially the node-constructors.
@L3MON4D3
Copy link
Owner Author

L3MON4D3 commented Oct 9, 2022

Oookay, gonna have one last look tomorrow when I don't have past-midnight-brain, then merge

@L3MON4D3 L3MON4D3 merged commit 032c565 into master Oct 10, 2022
parent (`parent.snippet`), which is passed to the function.
SNIPPET-DATA ~

Snippets contain some interesting tables during runtime: - `snippet.env`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't you want to make a list here? having all items of the list on the same line isn't specially readable :/

<


`t(text, node_opts)`: - `text`: `string` or `string[]` - `node_opts`: `table`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here



Examples: Use captures from the regex-trigger using a functionNode:
`f(fn, argnode_references, node_opts)`: - `fn`: `function(argnode_text, parent,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well


Node-references are used to refer to other nodes in various parts of
luasnip’s API. For example, argnodes in functionNode, dynamicNode or lambda
are node-references. These references can be either of: - `number`: the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also? for these references can be either of ....

that to construct `choiceNode`s:
`lua local function restore_cursor_choice(pos, choices, opts) if opts then opts.restore_cursor = true else opts = {restore_cursor = true} end return c(pos, choices, opts) end`

`c(jump_index, choices, node_opts)` - |luasnip-`jump_index`|: `number`, since
Copy link
Contributor

@bew bew Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here (I think searching for a dash surrounded by spaces can find you all inlined lists)

`match` can insert text based on a predicate (again, a shorthand for
`functionNode`).

`match(argnodes, condition, then, else)`, where * `argnode`: A single
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another list, using * instead of -

@L3MON4D3
Copy link
Owner Author

Mhmm, looks like the helptext-generator is messing those up.
Check DOC.md, there they actually are lists

@L3MON4D3
Copy link
Owner Author

pushed a fix, 4b8d678

@L3MON4D3
Copy link
Owner Author

Thank you for bringing them to my attention, I very rarely check the help-files 😅

@bew
Copy link
Contributor

bew commented Oct 10, 2022

Much better 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants