| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
* src/treesit.c (Ftreesit_pattern_expand): Use DEFSYM'd symbols
when the naming makes sense.
(syms_of_treesit): Add new defsyms QCanchor, QCequal, QCmatch.
|
|
|
|
|
| |
* src/treesit.c (treesit_make_ranges):
(Ftreesit_parser_set_included_ranges): Fix coding style.
|
|
|
|
| |
* msdos/sed1v2.inp: Edit out tree-sitter stuff.
|
|
|
|
|
| |
* lisp/treesit.el (treesit-font-lock-fontify-region): Use
treesit--children-covering-range to reduce the node size.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Generating imenu index doesn't require going down to the bottom of the
tree (defun's are usually top-level). Add limit so we don't go too
far down on very large buffers.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--imenu)
* lisp/progmodes/java-ts-mode.el (java-ts-mode--imenu)
* lisp/progmodes/js.el (js--treesit-imenu)
* lisp/progmodes/json-ts-mode.el (json-ts-mode--imenu)
* lisp/progmodes/python.el (python-imenu-treesit-create-index)
* lisp/textmodes/css-mode.el (css--treesit-imenu): Add limit to
treesit-induce-sparse-tree.
|
|
|
|
|
|
|
|
|
|
| |
* lisp/treesit.el (treesit--children-covering-range)
(treesit--children-covering-range-recurse): New functions. They are
not currently used but could be useful in the future, so I left them
in place.
(treesit-font-lock-fontify-region):
* lisp/treesit.el (treesit-font-lock-fontify-region): Use the result
of treesit-node-on instead of the root node.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisp/progmodes/python.el (python-base-mode)
(python--treesit-fontify-string):
* lisp/textmodes/css-mode.el (css-base-mode):
* lisp/treesit.el (treesit-ready-p, treesit-comment-end)
(treesit-simple-indent-presets): Fix typos and wording in doc strings.
* doc/lispref/parsing.texi (Tree-sitter major modes):
* doc/lispref/modes.texi (Parser-based Indentation): Fix wording
and add cross-references.
|
|
|
|
|
|
|
|
|
|
|
| |
* lisp/progmodes/c-ts-mode.el (c-ts-mode)
(c++-ts-mode)
* lisp/progmodes/java-ts-mode.el (java-ts-mode)
* lisp/progmodes/js.el (js-ts-mode)
* lisp/progmodes/json-ts-mode.el (json-ts-mode)
* lisp/progmodes/python.el (python-ts-mode)
* lisp/progmodes/sh-script.el (sh-mode)
* lisp/progmodes/ts-mode.el (ts-mode): Remove the MODE argument.
|
|
|
|
|
|
|
|
|
|
| |
Remove it since we are using separate major modes for tree-sitter and
native variant now.
* doc/lispref/parsing.texi (Tree-sitter major modes): Update manual.
* lisp/treesit.el (treesit-settings): Remove option.
(treesit--setting-for-mode): Remove function.
(treesit-ready-p): Don't check for user preference in treesit-settings.
|
|
|
|
|
|
| |
* lisp/progmodes/js.el (js-json--treesit-font-lock-settings)
(js--json-treesit-indent-rules): Remove variables.
(js-json-mode): Remove tree-sitter setup.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The goal is to indent like this:
/* comment
comment --> This line aligns with the beginning of the first line
*/ --> This line aligns with the opening comment token
* lisp/treesit.el (treesit-comment-start)
(treesit-comment-end): New variables.
(treesit-simple-indent-presets): New preset comment-end,
comment-start, comment-start-skip
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles)
(c-ts-mode)
* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules)
(java-ts-mode)
* lisp/progmodes/js.el (js--treesit-indent-rules)
(js-ts-mode)
* lisp/progmodes/ts-mode.el (ts-mode--indent-rules)
(ts-mode): Add identical indent rules to each mode, and set identical
treesit-comment-start/end's.
* doc/lispref/modes.texi (Parser-based Indentation)
* doc/lispref/parsing.texi (Tree-sitter major modes): Update manual.
|
|
|
|
|
|
|
|
| |
* lisp/progmodes/js.el (js-base-mode): New mode.
(js-mode): Return to before tree-sitter setup is added, change to
inherit from js-base-mode.
(js-ts-mode): New mode. Now it doesn't use any cc-mode feature,
meaning it looses comment filling.
|
|
|
|
|
|
|
|
| |
To keep consistency with other tree-sitter major modes.
* lisp/progmodes/python.el (python--treesit-settings)
(python-ts-mode): Merge function-name and class-name features into
definition.
|
|
|
|
|
|
|
| |
* lisp/progmodes/python.el (python-base-mode): New virtual mode that
contains most of the setup.
(python-mode): Change to inherit from python-base-mode.
(python-ts-mode): New mode that sets up tree-sitter.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisp/progmodes/css-ts-mode.el: Deleted.
* lisp/textmodes/css-mode.el (css--treesit-indent-rules)
(css--treesit-settings): New variables.
(css--treesit-imenu-1)
(css--treesit-imenu): New functions.
* lisp/textmodes/css-mode.el (css-base-mode): New mode inherited by
both css-mode and css-ts-mode.
(css-ts-mode): New mode.
(css-mode): Inherit from css-base-mode, and move some setup to
css-base-mode.
|
|
|
|
|
|
|
|
| |
I changed other presets to count all nodes a while ago, but forgot to
change 'match' too.
* lisp/treesit.el (treesit-simple-indent-presets): Change to count on
both named and anonymous nodes.
|
|
|
|
| |
* lisp/progmodes/sh-script.el: Change builtin to keyword.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Forgot to update python-mode's code when I added the tree-sitter
notifier facility. Now it doesn't need any special treatment anymore.
Leaving it as is causes some incorrect fontification.
* lisp/progmodes/python.el (python--treesit-fontify-string): Accept
the string node rather than the quote node.
(python--treesit-settings): Capture string node.
|
|
|
|
|
|
|
|
|
|
|
| |
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Use new
escape, number, property, operator, bracket, and delimiter font-lock
faces.
(c-ts-mode--base-mode): Add them to the feature list.
(c-ts-mode): Fix typo.
* lisp/progmodes/python.el (python--treesit-settings): Use new number,
property, operator, bracket, and delimiter font-lock faces.
(python-mode): Add them to the feature list.
|
|
|
|
|
|
|
|
|
| |
* lisp/progmodes/sh-script.el (sh-mode--treesit-settings): Add defvar.
(sh-mode): Change feature names.
(sh-mode--treesit-fontify-decl-command): Remove function.
(sh-mode--treesit-declaration-commands): New variable.
(sh-mode--treesit-settings): Change feature names. Simplify
declaration-command feature.
|
|
|
|
| |
* lisp/progmodes/sh-script.el: Stylistic change.
|
|
|
|
|
|
|
|
|
|
| |
* lisp/progmodes/sh-script.el (sh-mode): Add tree-sitter setup. Move
setup of font-lock-defaults into branch.
(sh-mode--treesit-operators)
(sh-mode--treesit-keywords)
(sh-mode--treesit-settings): New variables.
(sh-mode--treesit-other-keywords)
(sh-mode--treesit-fontify-decl-command): New functions.
|
|
|
|
|
|
| |
* doc/lispref/modes.texi (Parser-based Font Lock)
* lisp/treesit.el (treesit-font-lock-feature-list): Explain in more
detail, and change some features.
|
|
|
|
|
|
|
|
|
|
| |
* src/treesit.c (Ftreesit_parser_notifiers)
(Ftreesit_parser_add_notifier, Ftreesit_parser_remove_notifier):
Doc string fixes.
* doc/lispref/parsing.texi (Accessing Node Information): Fix
wording and punctuation.
(Using Parser): Improve indexing and wording.
|
|
|
|
| |
* src/treesit.c: Match against NODE at start of the loop.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changes:
1. Remove some :override flags
2. Fontify "!" in font-lock-negation-char-face
3. Use some new faces like font-lock-escape-face and
font-lock-property-face
4. Move all type fontification into 'type' feature. Previously some
are in 'definition' feature.
5. Simplify definition feature, and fontify identifiers in definitions
recursively.
6. Change 'statement' feature to 'label'
7. New feature 'assignment'
8. Remove some rules from 'expression' feature
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): See
above.
(c-ts-mode--fontify-declarator): New function.
(c-ts-mode): Update feature-list.
|
|
|
|
|
|
| |
* lisp/progmodes/c-ts-mode.el (c-ts-mode--imenu-1): If cannot find
its name, ignore the node.
(c-ts-mode--imenu): Don't include a category if it's empty.
|
|
|
|
|
|
|
|
|
| |
Now you can run (treesit-node-check node 'outdated).
* doc/lispref/parsing.texi (Accessing Node Information): Update
manual.
* src/treesit.c (Ftreesit_node_check): Add new property 'outdated'.
* test/src/treesit-tests.el (treesit-node-check): Add tests.
|
|
|
|
|
|
| |
* doc/lispref/parsing.texi (Using Parser): Update manual.
* lisp/treesit.el (treesit): Add shordocs.
* src/treesit.c: Augment docstrings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This mode is basically the tree-sitter playground[1] in Emacs:
displays the syntax tree with the source side-by-side, kept in sync in
real-time.
[1] https://tree-sitter.github.io/tree-sitter/playground
* doc/lispref/parsing.texi (Language Definitions): Mention in manual.
* lisp/treesit.el (treesit--explorer-buffer)
(treesit--explorer-source-buffer)
(treesit--explorer-language)
(treesit--explorer-refresh-timer)
(treesit--explorer-highlight-overlay)
(treesit--explorer-last-node): New variables.
* lisp/treesit.el (treesit--explorer--nodes-to-highlight)
(treesit--explorer-refresh)
(treesit--explorer-post-command)
(treesit--explorer-jump)
(treesit--explorer-highlight-node)
(treesit--explorer-draw-node): New functions.
(treesit--explorer-tree-mode)
(treesit-explore-mode): New modes.
|
|
|
|
|
|
|
|
| |
This rule corrects the fontification for DEFUN macros.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings):
Additional font-lock rules.
(c-ts-mode--fontify-defun): New function.
|
| |
|
|
|
|
|
| |
* src/treesit.c (ts_tree_get_changed_ranges) [WINDOWSNT]: Define,
load from the library, and call through a function pointer.
|
|
|
|
|
|
|
| |
I expect this to be turned off by default. but turn this on for
demonstration for now.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--base-mode): Enable error.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now nodes that are affected and changed during re-parse will be
correctly refontified. Nodes can change even if it corresponding text
wasn't edited: additional text can complete the parse tree and resolve
error nodes, for example.
* lisp/progmodes/python.el (python-mode): Create Python parser before
calling treesit-major-mode-setup.
* lisp/treesit.el (treesit--font-lock-notifier): New function.
(treesit-major-mode-setup): Register fontifier with every existing
parser.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now have a better facility that can replace the contextual
hack. The C part is in the previous commit, and the Lisp part work
will be in the next commit.
* doc/lispref/modes.texi (Parser-based Font Lock): Update manual.
* lisp/progmodes/js.el (js--treesit-font-lock-settings)
* lisp/progmodes/python.el (python--treesit-settings)
* lisp/progmodes/ts-mode.el (ts-mode--font-lock-settings): Stop marking
contextual nodes.
* lisp/treesit.el (treesit-font-lock-contextual-post-process): Remove
function.
(treesit-font-lock-fontify-region): Remove code processing contextual
nodes.
|
|
|
|
|
|
|
|
|
|
|
| |
* src/treesit.c (treesit_call_after_change_functions): New function.
(treesit_ensure_parsed): Call treesit_call_after_change_functions
right after re-parse.
(make_treesit_parser): Initialize after_change_functions.
(Ftreesit_parser_notifiers)
(Ftreesit_parser_add_notifier)
(Ftreesit_parser_remove_notifier): New functions.
* src/treesit.h (Lisp_TS_Parser): New field after_change_functions.
|
|
|
|
|
| |
* src/treesit.c (treesit_make_ranges): New function.
(Ftreesit_parser_included_ranges): Use treesit_make_ranges.
|
|
|
|
|
| |
* lisp/progmodes/c-ts-mode.el (c-ts-mode--base-mode): Remove error
feature.
|
|
|
|
|
|
| |
* test/src/treesit-tests.el (treesit-parser-supplemental): Remove
treesit-set-ranges, and treesit-get-ranges, as these functions are
removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(c-ts-mode--base-mode): Extract comment-* so that we can separate
between C and C++.
(c-ts-mode, c++-ts-mode): Set comment-* variables.
* lisp/progmodes/css-ts-mode.el (css-ts-mode): Add electric-indent.
* lisp/progmodes/java-ts-mode.el
(java-ts-mode--imenu): Add categories. Only display categories that
exist in the file.
(java-ts-mode): Add electric-indent.
* lisp/progmodes/json-ts-mode.el
(json-ts-mode): Add electric-indent.
* lisp/progmodes/ts-mode.el
(ts-mode--font-lock-settings): Whitespace cleanup.
(ts-mode): Add electric-indent.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
First of all, we signal error on using an outdated node, so if a node
has changes, calling treesit-node-check would only raise an error.
Besides, in order to properly answer whether a node has changed, we
would have to update the node as the buffer is edited, which we don't
do right now.
* doc/lispref/parsing.texi (Accessing Node Information): Remove
relevant manual text.
* src/treesit.c (Ftreesit_node_check): Remove docstring mentions,
remove the branch for "has-changes".
(syms_of_treesit): Remove has-changes.
|
|
|
|
|
|
|
|
| |
* src/treesit.c (treesit_load_language): Use 'xstrdup'/'xfree'
instead of 'strdup'/'free', to prevent crashes on MS-Windows,
where we must use our own implementation of 'malloc'/'free',
whereas 'strdup' uses the default implementation in the MS-Windows
C runtime library.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of a flat list, now categorize imenu entries into categories
like "Function", "Variable", "Class", etc.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--imenu-1): Handle more edge
cases.
(c-ts-mode--imenu): Categorize menu entries.
* lisp/progmodes/js.el (js--treesit-imenu-type-alist): Remove variable.
(js--treesit-imenu-label): Remove function.
(js--treesit-imenu-1): Use the name alone for labels.
(js--treesit-imenu): Categorize menu entries.
|
|
|
|
|
|
|
|
|
| |
* etc/NEWS: Fix typos. Change Tree-sitter to tree-sitter.
* lisp/progmodes/c-ts-mode.el
* lisp/progmodes/css-ts-mode.el
* lisp/progmodes/java-ts-mode.el
* lisp/progmodes/json-ts-mode.el: Change Tree Sitter to tree-sitter.
Fix typo.
|
|
|
|
|
|
|
|
|
| |
* etc/NEWS: Mention the new modes
* lisp/progmodes/c-ts-mode.el: New major mode with tree-sitter support
for C and C++.
* lisp/progmodes/java-ts-mode.el: New major mode with tree-sitter support.
* lisp/progmodes/json-ts-mode.el: New major mode with tree-sitter support.
* lisp/progmodes/css-ts-mode.el: New major mode with tree-sitter support.
|
|
|
|
|
|
|
|
|
|
| |
* lisp/treesit.el (treesit-node-at): Doc fix.
* doc/lispref/parsing.texi (Language Definitions): Add
cross-reference.
(Retrieving Nodes): Renamed from "Retrieving Node"; all references
changed.
(Retrieving Nodes): Fix wording and markup.
|
| |
|