Niklas Kröger
13752aba99
Fix extra newline from nimpretty when used with --stdin ( #24951 )
...
Using `echo` to print file contents to stdout automatically adds a
newline at the end of the file contents. When using nimpretty to auto
format files on save in some editors which replace the file contents
with the formatted ones this means that with every save/format operation
an additional newline is added to the end of the file. Using
`stdout.write` does not automatically add a newline at the end
preventing this issue.
Fixes #24950
(cherry picked from commit c1e6cf812f )
2025-05-19 17:48:01 +02:00
Mads Hougesen
1bae14aa25
feat(nimpretty): support formatting code from stdin ( #24676 )
...
This pr adds support for running `nimpretty` on stdin as described in
#24622 .
I tested `:%!nimpretty -` and `:%!nimpretty --stdin` in neovim and both
seems to work without issues.
(cherry picked from commit 1a7bc6d878 )
2025-03-03 14:01:49 +01:00
Mads Hougesen
ee59597cd4
Add directory input support to nimpretty ( #23590 )
...
Feel free to close if this an unwanted addition :)
2024-05-10 10:33:03 +02:00
Andreas Rumpf
cd4ecddb30
nimpretty: check the rendered AST for wrong output ( #23057 )
2023-12-13 10:39:10 +01:00
Andrey Makarov
a660c17d30
Markdown code blocks migration part 8 ( #22478 )
2023-08-15 06:27:36 +02:00
metagn
ba698d37c3
some Token refactors ( #21762 )
...
* test some Token refactors
* fix CI
* showcase for more reductions, will revert
* Revert "showcase for more reductions, will revert"
This reverts commit 5ba48591f4 .
* make line and column int32
* remove int32 change
2023-05-06 21:27:28 +02:00
ringabout
a15872ba9e
refactor strongSpaceB with an enum ( #20809 )
...
refactor strongSpaceB
2022-11-10 16:21:52 +01:00
ringabout
0b1d1b7886
fixes #15688 ; handle strongSpace overflow issues ( #20724 )
...
* fixes #15688 ; handle `strongSpace` overflow issues
* stop at 1
* change the type of strongSpaceA to bool
2022-11-03 09:18:09 +01:00
ringabout
6082b9ea5d
fixes #20553 ; don't format code for stropping identifier ( #20561 ) [backport]
...
* fixes #20553 ; don't format code for stropping identifier
* add tests
* Update nimpretty/tests/expected/simple.nim
2022-10-13 23:37:41 +02:00
Smarcy
fcf1df6e56
fixed typos ( #19316 )
2022-01-03 15:04:15 -05:00
Timothee Cour
20248a68fd
gitutils: add diffStrings, diffFiles, and use it in testament to compare expected vs gotten ( #17892 )
...
* gitutils: add diffStrings, diffFiles, and use it in testament to compare expected vs gotten
* refactor with createTempDir
* cleanup
* refacotr
* PRTEMP fake test spec changes to show effect of diffStrings
* add runnableExamples for experimental/diff + cross-reference with gitutils
* Revert "PRTEMP fake test spec changes to show effect of diffStrings"
This reverts commit 57dc8d642d .
2021-04-30 11:00:33 +02:00
Timothee Cour
a424075b5e
improve nimsuggest/tester, minor improvements to koch.nim ( #17879 )
...
* improve nimsuggest/tester
* koch improvements
2021-04-29 13:44:53 +02:00
Miran
4f0bac791a
fix #12155 , improve nimpretty's handling of pragmas ( #17353 )
2021-03-12 15:34:42 +01:00
flywind
d447c0fe3f
use typeof instead type ( #16962 )
2021-02-08 09:46:07 +01:00
Bung
204435ad97
export PrettyOptions,prettyPrint from nimpretty ( #15865 )
2020-11-09 12:05:17 +01:00
Clyybber
f20e485827
Fix commentOffsetA for doc comments ( #15643 )
2020-10-20 01:19:49 +02:00
Andreas Rumpf
992952d868
nimpretty: do not produce 'line too long' messages ( #15541 )
2020-10-10 17:46:22 +02:00
Clyybber
13e659cfec
Big compiler Cleanup ( #14777 )
2020-08-28 22:18:09 +02:00
Alexander Wolfe
124feb2af8
nimpretty support for multiple files ( #14890 )
2020-07-12 16:07:31 +02:00
Timothee Cour
dc5a40f3f3
{.deprecated: [existsFile: fileExists].} ( #14735 )
...
* {.deprecated: [existsFile: fileExists].}
* s/existsFile/fileExists/ except under deps
* workaround pending #14819
* fix test
2020-07-02 16:19:13 +02:00
Miran
1edb9a6178
fix #14401 , trailing comma confuses nimpretty ( #14867 )
2020-07-01 11:40:13 +02:00
Juan Carlos
8e54bc5b0c
Deprecate and/or remove ospaths ( #14767 )
2020-06-23 10:51:33 +02:00
Jacek Sieka
7d6cbf290a
Error -> Defect for defects ( #13908 )
...
* Error -> Defect for defects
The distinction between Error and Defect is subjective,
context-dependent and somewhat arbitrary, so when looking at an
exception, it's hard to guess what it is - this happens often when
looking at a `raises` list _without_ opening the corresponding
definition and digging through layers of inheritance.
With the help of a little consistency in naming, it's at least possible
to start disentangling the two error types and the standard lib can set
a good example here.
2020-04-28 19:56:01 +02:00
Jasper Jenkins
28b6b1c3fb
fix nimpretty warning ( #13700 )
2020-03-20 09:22:40 +01:00
Juan Carlos
0809098971
Nimpretty Fix negative indent breaks code ( #13580 )
2020-03-04 10:27:52 +01:00
Jasper Jenkins
796aafe7e0
make case-object transitions explicit, make unknownLineInfo a const, replace a few magic numbers with consts ( #13170 )
2020-01-17 10:34:31 +01:00
Federico Ceratto
39290cf88c
Fix spellings ( #12277 ) [backport]
2019-09-27 07:02:54 +02:00
narimiran
ceb742351a
nimpretty: fix #11937 (wrong indentation)
2019-08-19 13:35:10 +02:00
narimiran
cf4390a24a
cosmetic improvements
...
* remove unused imports
* make 'openPars' and 'closedPars' more readable
2019-08-19 13:29:45 +02:00
Araq
6d8913ee14
nimpretty: fixes #11616
2019-07-18 12:13:22 +02:00
Araq
7deb49e992
nimpretty: fixes #11699
2019-07-18 11:28:25 +02:00
Araq
5b7273b4f8
[refactoring] nimpretty
2019-07-18 11:00:29 +02:00
Araq
5bf3734984
nimpretty: implement a --maxLineLen command line option
2019-07-12 10:23:21 +02:00
Miran
2f0a50fa51
nimpretty: fix #11700 , no extra newlines ( #11714 )
2019-07-12 09:14:21 +02:00
Araq
cb3c3c306c
minor style changes
2019-07-11 00:28:20 +02:00
narimiran
96d49608c0
nimpretty: more comment indentation fixes
2019-07-09 13:15:35 +02:00
Araq
eefcea8892
nimpretty: more improvements
2019-07-09 11:38:01 +02:00
Araq
0193c8ad2e
nimpretty: yet another improvement
2019-07-09 11:38:01 +02:00
Miran
d0616ed115
nimpretty: don't introduce extra spaces after a colon or a comma ( #11672 )
2019-07-07 20:13:10 +02:00
Miran
34c09a98c7
nimpretty: improved detection of commas and semicolons ( #11661 )
...
* nimpretty: improved detection of commas and semicolons
* address the comments
2019-07-06 00:21:21 +02:00
Miran
176eaf5c90
nimpretty: don't touch formatted multiline comments ( #11663 )
2019-07-05 21:47:01 +02:00
Miran
96a19ea1b4
nimpretty: relax line length rules when dealing with (inline) comments ( #11657 )
2019-07-05 09:32:56 +02:00
Miran
0718d6c2cd
[bugfix] fix wrong nimpretty unidents, refs #11616 ( #11645 )
2019-07-03 18:55:15 +02:00
Miran
c522a455df
[bugfix] nimpretty indents multiline comments correctly ( #11607 )
2019-07-02 10:52:46 +02:00
Araq
284a8cb58a
nimpretty: bugfix [bugfix]
2019-06-28 11:45:21 +02:00
Miran
f288e1b11a
[bugfix] fix #11469 , new rules for a newline in nimpretty ( #11512 )
...
* [bugfix] fix #11469 , new rules for a newline in nimpretty
* concatenate two lines if they have the same indentation level
2019-06-26 15:36:44 +02:00
Araq
57a83df745
[bugfix] nimpretty: better alignment; fixes #11467
2019-06-14 11:16:39 +02:00
Araq
165ea46284
[bugfix] nimpretty: fixes #11470
2019-06-13 10:58:27 +02:00
Araq
af39f26a3a
[bugfix] nimpretty: fixes #11468
2019-06-13 10:42:37 +02:00
Jasper Jenkins
da035e9c83
[bugfix] fix nimpretty for absolute paths ( #11480 )
2019-06-12 11:59:25 +02:00