summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes
Commit message (Collapse)AuthorAgeFilesLines
* ; Fix typosStefan Kangas2024-05-271-2/+2
|
* Fix Python font lock of chained assignment statementkobarity2024-05-241-0/+10
| | | | | | | | | * lisp/progmodes/python.el (python-font-lock-keywords-maximum-decoration): Allow chaining of single assignment statements. * test/lisp/progmodes/python-tests.el (python-font-lock-assignment-statement-20): New test. (Bug#71093)
* Fix last changeEli Zaretskii2024-04-271-1/+1
| | | | | | * test/lisp/progmodes/csharp-mode-tests.el (csharp-ts-mode-test-indentation): If need to skip the tree-sitter test, do so silently. (Bug#70345)
* ; Skip 'csharp-ts-mode' test if grammar is missingjohn muhl2024-04-271-0/+1
| | | | | | * test/lisp/progmodes/csharp-mode-tests.el (csharp-ts-mode-test-indentation): Skip test instead of failing. (Bug#70345)
* Fix last changeEli Zaretskii2024-04-253-30/+3
| | | | | | | | * test/lisp/progmodes/csharp-mode-tests.el (csharp-ts-mode-test-indentation): Move the test to here. * test/lisp/progmodes/csharp-ts-mode-tests.el: Remove file. * test/lisp/progmodes/csharp-ts-mode-resources/indent.erts: Move to test/lisp/progmodes/csharp-mode-resources/indent-ts.erts.
* Fix indentation of if/else in 'csharp-ts-mode' (bug#70345)Jacob Leeming2024-04-252-0/+81
| | | | | | | | | | | * lisp/progmodes/csharp-mode.el (csharp-ts-mode--indent-rules): Fix indentation rules for 'if' and 'else'. * test/lisp/progmodes/csharp-ts-mode-tests.el: * test/lisp/progmodes/csharp-ts-mode-resources/indent.erts: New test files. Copyright-paperwork-exempt: yes
* Make object init more robust (bug#69571)Theodor Thornhill2024-03-311-0/+78
| | | | | | * lisp/progmodes/csharp-mode.el (csharp-guess-basic-syntax): Make the regex same as before, but conditionally check other heuristics rather than crazy regex shenanigans.
* Add test for previous change (bug#70023)Theodor Thornhill2024-03-281-0/+14
| | | | | * test/lisp/progmodes/typescript-ts-mode-resources/indent.erts: Add test.
* Tweak regexp for object initializers in csharp-mode (bug#69571)Theodor Thornhill2024-03-162-0/+49
| | | | | | | | | * lisp/progmodes/csharp-mode.el (csharp-guess-basic-syntax): Add handling to not consider ended statements as object init openers. * test/lisp/progmodes/csharp-mode-resources/indent.erts: New test resources. * test/lisp/progmodes/csharp-mode-tests.el: Add test for this particular issue.
* java-ts-mode: Indentation for opening brace on a separate lineDmitry Gutov2024-02-171-0/+31
| | | | | | | | * lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): Support putting the opening brace on a separate line (bug#67556). * test/lisp/progmodes/java-ts-mode-resources/indent.erts: Add a test.
* typescript-ts-mode: Skip test if tsx grammar missingMatthew Smith2024-01-201-1/+2
| | | | | | | | | | | | | typescript-ts-mode-test-indentation depends on both the tree-sitter typescript grammar, and the tree-sitter tsx grammar. If only the typescript is installed, the tests will run and then fail unexpectedly after tsx fails to load. * test/lisp/progmodes/typescript-ts-mode-tests.el (typescript-ts-mode-test-indentation): Skip test if tsx grammar is missing. Copyright-paperwork-exempt: yes
* ; Add 2024 to copyright yearsPo Lu2024-01-0237-37/+37
|
* Improve syntax highlighting for python-ts-modeDenis Zubarev2023-12-301-0/+302
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix fontification of strings inside of f-strings interpolation, e.g. for f"beg {'nested'}" - 'nested' was not fontified as string. Do not override the face of builtin functions (all, bytes etc.) with the function call face. Add missing assignment expressions (:= *=). Fontify built-ins (dict,list,etc.) as types when they are used in type hints. Highlight union types (type1|type2). Highlight base class names in the class definition. Fontify class patterns in case statements. Highlight the second argument as a type in isinstance/issubclass call. Highlight dotted decorator names. * lisp/progmodes/python.el (python--treesit-keywords): Add compound keyword "is not". (python--treesit-builtin-types): New variable that stores all python built-in types. (python--treesit-type-regex): New variable. Regex matches if text is either built-in type or text starts with capital letter. (python--treesit-builtins): Extract built-in types to other variable. (python--treesit-fontify-string): fix f-string interpolation. Enable interpolation highlighting only if string-interpolation is presented on the enabled levels of treesit-font-lock-feature-list. (python--treesit-fontify-string-interpolation): Remove function. (python--treesit-fontify-union-types): Fontify nested union types. (python--treesit-fontify-union-types-strict): Fontify nested union types, only if type identifier matches against python--treesit-type-regex. (python--treesit-fontify-dotted-decorator): Fontify all parts of dotted decorator name. (python--treesit-settings): Change/add rules. (Bug#67061) * test/lisp/progmodes/python-tests.el (python-ts-tests-with-temp-buffer): Function for setting up test buffer. (python-ts-mode-compound-keywords-face) (python-ts-mode-named-assignement-face-1) (python-ts-mode-assignement-face-2) (python-ts-mode-nested-types-face-1) (python-ts-mode-union-types-face-1) (python-ts-mode-union-types-face-2) (python-ts-mode-types-face-1) (python-ts-mode-types-face-2) (python-ts-mode-types-face-3) (python-ts-mode-isinstance-type-face-1) (python-ts-mode-isinstance-type-face-2) (python-ts-mode-isinstance-type-face-3) (python-ts-mode-superclass-type-face) (python-ts-mode-class-patterns-face) (python-ts-mode-dotted-decorator-face-1) (python-ts-mode-dotted-decorator-face-2) (python-ts-mode-builtin-call-face) (python-ts-mode-interpolation-nested-string) (python-ts-mode-disabled-string-interpolation) (python-ts-mode-interpolation-doc-string): Add tests.
* ruby-ts-mode: Fix indentation for string_array closerDmitry Gutov2023-12-241-0/+4
| | | | | * lisp/progmodes/ruby-ts-mode.el (ruby-ts--indent-rules): Fix indentation for string_array closer.
* Add indentation rules for bracketless statements in js-ts-modeNoah Peart2023-12-122-0/+50
| | | | | | | | | * lisp/progmodes/js.el (js--treesit-indent-rules): Add indentation rules to handle bracketless statements (bug#67758). * test/lisp/progmodes/js-tests.el (js-ts-mode-test-indentation): New test for js-ts-mode indentation. * test/lisp/progmodes/js-resources/js-ts-indents.erts: New file with indentation tests for js-ts-mode.
* Fix c-ts-mode bracketless indentation for BSD style (bug#66152)Yuan Fu2023-12-101-0/+34
| | | | | | | | | * lisp/progmodes/c-ts-mode.el: (c-ts-mode--indent-styles): Make sure the BSD rules only apply to opening bracket (compound_statement), then bracketless statements will fallback to common rules. * test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts: Copy the bracketless test from indent.erts to here.
* Fix c-ts-mode indentation (bug#67357)nverno2023-12-101-1/+47
| | | | | | | | | | | | | | | | | | | 1. In a compund_statement, we indent the first sibling against the parent, and the rest siblings against their previous sibling. But this strategy falls apart when the first sibling is not on its own line. We should regard the first sibling that is on its own line as the "first sibling"", and indent it against the parent. 2. In linux style, in a do-while statement, if the do-body is bracket-less, the "while" keyword is indented to the same level as the do-body. It should be indented to align with the "do" keyword instead. * lisp/progmodes/c-ts-mode.el: (c-ts-mode--no-prev-standalone-sibling): New function. (c-ts-mode--indent-styles): Use c-ts-mode--no-prev-standalone-sibling. Add while keyword indent rule. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New tests.
* ruby-mode: Better detect regexp vs division (bug#67569)Dmitry Gutov2023-12-091-0/+12
| | | | | | * lisp/progmodes/ruby-mode.el (ruby-syntax-before-regexp-re): Add grouping around methods from the whitelist. (ruby-syntax-propertize): Also look for spaces around the slash.
* ; Fix typosStefan Kangas2023-12-031-1/+1
|
* Fix typescript-ts-mode indentation for switch statementsnverno2023-11-291-0/+17
| | | | | * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): Add indentation rule for switch case and default keywords. (Bug#67488)
* Fix indentation for else clause in c-ts-mode (bug#67417)Yuan Fu2023-11-261-0/+20
| | | | | | | | | | * lisp/progmodes/c-ts-mode.el: (c-ts-mode--indent-styles): Add indentation for children of else_clause. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: (Name): Add test for else-break. Also make the test such that it needs to indent correctly from scratch (rather than maintaining the already correct indentation.)
* Annotate java-ts-mode-test-movement with expected resultDmitry Gutov2023-11-211-0/+2
| | | | Do not merge to master.
* Backport: Add more java indentation testsTheodor Thornhill2023-11-211-16/+75
| | | | | | | * test/lisp/progmodes/java-ts-mode-resources/indent.erts: Use default indent offset, and tweak the indentation examples. (cherry picked from commit dbe7803aa1e8249bd70f67f25f19aedabeb9cc22)
* Backport: Add test for java indentation (bug#61115)Theodor Thornhill2023-11-211-0/+9
| | | | | | | * test/lisp/progmodes/java-ts-mode-resources/indent.erts: Add new test case. (cherry picked from commit 229d0772e235f51812ed8020a31f9a8de366c7ba)
* typescript-ts-mode: Support indentation for conditionals without bracesNoah Peart2023-11-211-0/+22
| | | | | | | | | * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules): Support indentation for conditionals without braces (bug#67031). * test/lisp/progmodes/typescript-ts-mode-resources/indent.erts (Statement indentation without braces): New test.
* Backport: Add some basic tests for java-ts-mode and typescript-ts-modeTheodor Thornhill2023-11-215-0/+337
| | | | | | | | | | | | | * test/lisp/progmodes/java-ts-mode-resources/indent.erts: New file with tests for indentation. * test/lisp/progmodes/java-ts-mode-resources/movement.erts: New file with tests for movement. * test/lisp/progmodes/java-ts-mode-tests.el: New tests. * test/lisp/progmodes/typescript-ts-mode-resources/indent.erts: New file with tests for indentation. * test/lisp/progmodes/typescript-ts-mode-tests.el: New tests. (cherry picked from commit c8dd37b16c574beda900d4ee48ac7b4ab4a2ee56)
* Make js-beginning-of-defun return non-nil on successDaniel Martín2023-06-291-0/+51
| | | | | | | | | | | | | The docstring of 'beginning-of-defun-function' says that the function shall return non-nil when it found the beginning of a defun. This is specially important because the calling code decides when to move point depending on the return value. * lisp/progmodes/js.el (js-beginning-of-defun) (js--beginning-of-defun-flat): Return non-nil when the beginning of a defun is found. (Bug#64283) * test/lisp/progmodes/js-tests.el (js-mode-end-of-defun): Add a unit test.
* Revert "Enhance Python font-lock to support multilines"kobarity2023-06-031-144/+0
| | | | | | | | | | | | | | | | | This reverts commit 4915ca5dd4245a909c046e6691e8d4a1919890c8. We have found that there are performance issues when editing a large file. The issue can be reproduced as follows: 1. emacs -Q 2. Open large Python file (e.g. turtle.py in Python) 3. Near the top of the buffer, enter open paren and some characters. The above commit extends the region to be font-locked using `python-nav-end-of-statement'. However, if there are unbalanced parens, it may move point to the end of the buffer. This causes almost the entire buffer to be font-locked, which is not acceptable for large files.
* Fix python-info-docstring-pkobarity2023-05-261-0/+16
| | | | | | | | | | | | | * lisp/progmodes/python.el (python-info-docstring-p): Stop using python-rx string-delimiter. * test/lisp/progmodes/python-tests.el (python-font-lock-escape-sequence-bytes-newline) (python-font-lock-escape-sequence-hex-octal) (python-font-lock-escape-sequence-unicode) (python-font-lock-raw-escape-sequence): Mark as expected failures until another bug in 'python-info-docstring-p' is corrected. (python-info-docstring-p-7): New test. (Bug#63622)
* ruby-add-log-current-method: Reduce the use of 'nreverse'Dmitry Gutov2023-04-131-0/+16
| | | | | | | | | * lisp/progmodes/ruby-mode.el (ruby-add-log-current-method): Reduce the use of 'nreverse' (bug#62761). * test/lisp/progmodes/ruby-mode-tests.el (ruby-add-log-current-method-singleton-referencing-outer): New test.
* Fix a couple of eglot-testsBasil L. Contovounesios2023-04-111-1/+2
| | | | | | | * test/lisp/progmodes/eglot-tests.el (eglot-test-rust-analyzer-watches-files): Bump timeout. (eglot-test-json-basic): Check for yas-minor-mode before using it, like other tests do (bug#61637).
* Fix some cases of incomplete code's indentation [c/c++-ts-mode]Dmitry Gutov2023-04-101-0/+14
| | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-base--before-indent): Try to guess when the parse tree is incomplete, and provide a better node to indent against (bug#62717). (c-ts-base-mode): Set up advice for local treesit-indent-function.
* ; Backport: Eglot: fix misplaced parenthesis in last commit to eglot-tests.elJoão Távora2023-04-091-1/+1
| | | | | | | * test/lisp/progmodes/eglot-tests.el (eglot-test-eldoc-after-completions): Fix misplaced parenthesis. (cherry picked from commit 3aedd5c920560fe6456a860a900be40a35e850d2)
* Backport: Eglot: no more tests based on Pylsp (bug#62694)João Távora2023-04-091-112/+85
| | | | | | | | | | | | | | | | | | | | | | | The functionality under test in eglot.el is exactly the same, but use the clangd server only, as that is used in more tests, and it is much easier to check if it misbehaves or not. Tests pass with clangd version 15. * test/lisp/progmodes/eglot-tests.el (python): Don't require it. (eglot--call-with-fixture): Simplify. (eglot--wait-for-clangd): New helper. (eglot-test-basic-completions) (eglot-test-non-unique-completions, eglot-test-basic-xref) (eglot-test-snippet-completions) (eglot-test-snippet-completions-with-company) (eglot-test-eldoc-after-completions, eglot-test-multiline-eldoc): Use clangd, not pylsp. (eglot-test-formatting): Renamed from eglot-test-python-autopep-formatting. (eglot-test-python-yapf-formatting): Remove. (cherry picked from commit fc8230f3362b12955152f48565a6c670b4c4cc88)
* Skip ruby-ts-imenu-index test if neededMichael Albinus2023-03-281-0/+1
| | | | | * test/lisp/progmodes/ruby-ts-mode-tests.el (ruby-ts-imenu-index): Add check for treesitter.
* Fix Eglot Tramp tests on EMBAMichael Albinus2023-03-281-0/+1
| | | | | * test/lisp/progmodes/eglot-tests.el (eglot--call-with-tramp-test): Bind `tramp-allow-unsafe-temporary-files' with t. (Bug#62289)
* ruby-ts-mode: Fix/simplify Imenu index generationDmitry Gutov2023-03-271-0/+25
| | | | | | | | | | | | | | | * lisp/progmodes/ruby-ts-mode.el (ruby-ts--full-name): Drop '#' from the end of resulting string when the node is not a method. Support 'singleton_method' nodes. (ruby-ts--imenu-helper): Simplify, to create a "flat" list of entries, rather than a nested one. The previous implementation had problems (like producing a nested structure of full-qualified names, thus creating a lot of textual repetition), seems easier to just follow ruby-mode's example here, at least for Emacs 29's release. * test/lisp/progmodes/ruby-ts-mode-tests.el (ruby-ts-imenu-index): New test.
* Improve indenting "case" in Pythonkobarity2023-03-261-0/+38
| | | | | | | | * lisp/progmodes/python.el (python-info-dedenter-statement-p): Do not consider the first "case" in the block as dedenter. * test/lisp/progmodes/python-tests.el (python-info-dedenter-opening-block-positions-7) (python-info-dedenter-statement-p-6): New tests. (Bug#62092)
* Add missing indent rule for c-ts-modeYuan Fu2023-03-211-0/+30
| | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): New rule for case. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.
* Fix python-fill-paragraph problems on filling strings (bug#62142)kobarity2023-03-161-0/+119
| | | | | | | | | | | | | | | | * lisp/progmodes/python.el (python-syntax--context-compiler-macro) (python-syntax-context): Add single-quoted-string and triple-quoted-string as TYPE argument. (python-info-triple-quoted-string-p): New helper function. (python-fill-paragraph) (python-fill-string): Use it. * test/lisp/progmodes/python-tests.el (python-syntax-context-1) (python-fill-paragraph-single-quoted-string-1) (python-fill-paragraph-single-quoted-string-2) (python-fill-paragraph-triple-quoted-string-1) (python-info-triple-quoted-string-p-1) (python-info-triple-quoted-string-p-2) (python-info-triple-quoted-string-p-3): New tests.
* Make "case" keyword a dedenter in Pythonkobarity2023-03-111-0/+15
| | | | | | | * lisp/progmodes/python.el (python-rx): Add "case" to dedenter. (python-info-dedenter-opening-block-positions): Add "case" to pairs. * test/lisp/progmodes/python-tests.el (python-indent-dedenters-9): New test.
* Skip ruby-ts-syntax-propertize-symbol unless treesitter is availableRobert Pluim2023-03-101-0/+1
| | | | | | * test/lisp/progmodes/ruby-ts-mode-tests.el (ruby-ts-syntax-propertize-symbol): Add check for treesitter.
* ruby-ts-mode: Fine-tune s-p-f on symbols (bug#62086)Dmitry Gutov2023-03-091-0/+15
| | | | | | | | | | | * lisp/progmodes/ruby-ts-mode.el (ruby-ts--s-p-query): Don't match ':' in symbol node text. Or '_', I suppose. (ruby-ts--syntax-propertize): Make sure to only put the '_' syntax on punctuation syntax characters, and not on the whole symbol (to e.g. have symbols like :foo? include text recognized as word). * test/lisp/progmodes/ruby-ts-mode-tests.el (ruby-ts-syntax-propertize-symbol): New test.
* python-info-dedenter-opening-block-positions: Fix to support "bare" matchDmitry Gutov2023-03-091-0/+14
| | | | | | | | | * lisp/progmodes/python.el (python-info-dedenter-opening-block-positions): Make the check stricter. Require that block starts only at indentation. * test/lisp/progmodes/python-tests.el (python-indent-after-bare-match): Another test (bug#62031).
* Fix searching for end of string in python-nav-end-of-statementkobarity2023-03-091-0/+44
| | | | | | | | * lisp/progmodes/python.el (python-nav-end-of-statement): Add searching for corresponding string-quote. * test/lisp/progmodes/python-tests.el (python-nav-end-of-statement-3) (python-nav-end-of-statement-4, python-info-current-defun-4): New tests. (Bug#58780)
* Don't misindent 'else:' after 'if re.match:' in PythonDmitry Gutov2023-03-081-0/+12
| | | | | | | | | | | * lisp/progmodes/python.el (python-info-dedenter-opening-block-positions): Check that the supposed block start is not a method call (bug#62031). * test/lisp/progmodes/python-tests.el (python-indent-after-re-match): New test. Co-authored-by: Lele Gaifax <lele@metapensiero.it>
* Fix empty line indentation in c-ts-mode (bug#61997)Yuan Fu2023-03-071-0/+16
| | | | | | | | | | * lisp/progmodes/c-ts-mode.el: (c-ts-mode--indent-styles): Handle the empty line case. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test. * doc/lispref/modes.texi (Parser-based Indentation): Update manual. * lisp/treesit.el (treesit-simple-indent-presets): Support null as a value for NODE-TYPE in the 'match' matcher.
* Fix c-ts-mode indentationYuan Fu2023-03-051-0/+3
| | | | | | | | | Mentioned in bug#61893. * lisp/progmodes/c-ts-mode.el (c-ts-mode--anchor-prev-sibling): Handle "#elif" and "#else". * test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts: Add an "#elif" to the test.
* Fix c-ts-mode indentationYuan Fu2023-03-051-0/+16
| | | | | | | | | | Mentioned in bug#61893, although not the subject of it. * lisp/progmodes/c-ts-mode.el: (c-ts-mode--anchor-prev-sibling): Fix the child index for preproc_else and preproc_elif case. * test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts: New test.
* Fix c-ts-mode indentationYuan Fu2023-03-051-0/+16
| | | | | | | | Not the subject of it, but mentioned in bug#61893. * lisp/progmodes/c-ts-mode.el (c-ts-mode--anchor-prev-sibling): Skip the sibling if it doesn't start on it's own line. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.