summary refs log tree commit diff stats
path: root/nimsuggest/tests
Commit message (Collapse)AuthorAgeFilesLines
* Implemented basic macro expand functionality (#20579)Ivan Yonchovski2023-01-272-4/+45
| | | | | | | | | | | | | | | | | | * Implemented level based macro expand functionality - it can handle single macro call or expand whole function/proc/etc and it - In addition, I have altered the parser to provide the endInfo for the node. The usefulness of the `endInfo` is not limited to the `expandMacro` functionality but also it is useful for `ideOutline` functionality and I have altered the ideOutline functionality to use `endInfo`. Note `endInfo` most of the time is lost during the AST transformation thus in `nimsuggest.nim` I am using freshly parsed tree to get the location information. * Make sure we stop expanding correctly * Test CI * Fix tv3_outline.nim
* Fix nimsuggest not suggesting fields in when theres static parameters (#21189)Jake Leahy2022-12-281-0/+18
| | | | | Don't check against empty arguments Add test case
* Nimsuggest now defines the backends symbol (#21083)Jake Leahy2022-12-122-0/+8
| | | | | | | * Add testcase * Define the backend symbol * Remove unneeded whitespace
* fix bugs with dot & call operators [backport] (#20931)metagn2022-11-281-2/+0
| | | | | | | | | | | | | | | | | | | * better error messages for dot operators [backport] fixes #13063 * also fixes #7777 * fix #6981 and #9831 too * fix * minor improvement * sus test fixes * make test multiplatform lol * fix nimsuggest test, extra improvements
* 'lock levels' are deprecated, now a noop (#20539)ringabout2022-10-118-24/+24
| | | | | * 'lock levels' are deprecated, now a noop * fixes tests
* Fix/improve handling of forward declarations in nimsuggest (#20493)Ivan Yonchovski2022-10-062-0/+37
| | | | | | | | | | | | | | | | | * Fix/improve handling of forward declarations in nimsuggest - ideUse now works fine when invoked on the implementation - implemented ideDeclaration to make cover lsp feature textDocument/declaration - fixed performance issue related to deduplicating symbols. Now the deduplication happens after the symbols are filtered. As a alternative we might change the way cached symbols are stored(e. g. use set). - I also fixed the way globalSymbols work. Now it will sort the responses based on the match location to make sure that the results are sorted in user friendly way. * Update nimsuggest/nimsuggest.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* moderate system cleanup & refactor (#20355)metagn2022-09-282-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * system refactor, move out 600 lines * compilation, slice, backwardsindex, misc_num moved out of system * some procs/types moved into arithmetics, basic_types * system no longer depends on syncio * some procs moved around to fit with their surroundings * make exceptions an import, old ops to misc_num * move instantiationInfo back * move back nim version, fix windows echo * include compilation * better docs for imported modules, fix unsigned ops also remove ze, ze64, toU8, toU16, toU32 with nimPreviewSlimSystem * fix terminal * workaround IC test & weird csize bug, changelog * move NimMajor etc back to compilation, rebase for CI * try ic fix * form single `indices`, slim out TaintedString, try fix IC * fix CI, update changelog, addQuitProc * fix CI * try fix CI * actually fix CI finally hopefully * Update lib/system/compilation.nim Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> * update kochdocs * hopefully fix csize uses for slimsystem * fix tquit Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* [nimsuggest] fix def call on identifier 2 times on the line (#20228)Ivan Yonchovski2022-08-302-0/+15
| | | | | | | - apparently TLineInfo's implementation of `==` ignores the column. After I fixed the code to use exact TLineInfo comparison I fixed several other issues hidden by that issue. - Replaced `tuple[sym, info]` with `SymInfoPair`
* Use module actual file instead of PSym.info (#19956)Ivan Yonchovski2022-07-151-0/+7
| | | After this you can do goto module from module import
* Implement type command (#19944)Ivan Yonchovski2022-07-151-0/+32
| | | | | | | | | | | * Implement type command - this will be mapped to textDocument/typeDefinition in LSP protocol. It will be very useful for `nim` in particular because typically most of the time the type is inferred. * Update nimsuggest/nimsuggest.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Initial implementation of nimsuggest v3 (#19826)Ivan Yonchovski2022-06-131-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial implementation of nimsuggest v3 Rework `nimsuggest` to use caching to make usage of ide commands more efficient. Previously, all commands no matter what the state of the process is were causing clean build. In the context of Language Server Protocol(LSP) and lsp clients this was causing perf issues and overall instability. Overall, the goal of v3 is to fit to LSP Server needs - added two new commands: - `recompile` to do clean compilation - `changed` which can be used by the IDEs to notify that a particular file has been changed. The later can be utilized when using LSP file watches. - `globalSymbols` - searching global references - added `segfaults` dependency to allow fallback to clean build when incremental fails. I wish the error to be propagated to the client so we can work on fixing the incremental build failures (typically hitting pointer) - more efficient rebuild flow. ATM incremental rebuild is triggered when the command needs that(i. e. it is global) while the commands that work on the current source rebuild only it Things missing in this PR: - Documentation - Extensive unit testing. Although functional I still see this more as a POC that this approach can work. Next steps: - Implement `sug` request. - Rework/extend the protocol to allow better client/server communication. Ideally we will need push events, diagnostics should be restructored to allow per file notifications, etc. - implement v3 test suite. - better logging * Add tests for v3 and implement ideSug * Remove typeInstCache/procInstCache cleanup * Add ideChkFile command * Avoid contains call when adding symbol info * Remove log * Remove segfaults
* Make sure that field usage preserves the original line info (#19751)Ivan Yonchovski2022-04-291-0/+15
| | | | Currently `struct.field` will generate a node with `info` that points to the symbol definition instead of having the actual node location.
* [nimsuggest] return the type when on symbol in let/var (#19639)Ivan Yonchovski2022-04-071-0/+7
| | | - make sure `suggestSym` is called after `PSym.typ` is set.
* improvements to `addInt` and `$` for integer types (#18592)Timothee Cour2021-08-191-1/+1
| | | | | | | | * improvements to $(SomeInteger) and addInt * remove mIntToStr, mInt64ToStr * improvements * fix tests/pragmas/tinjectstmt.nim; the diff is harmless, cgen code is identical with -d:danger or debug mode * rm tests/system/tstrmantle.nim * revert compiler/jsgen.nim for -d:nimVersion140
* improvements to hint:processing: show import stack, distinguish nims, show ↵Timothee Cour2021-06-303-3/+3
| | | | | | | | includes etc (#18372) * improvements to hint:processing * fix tests; do not show hintProcessing for nimscript unless given -d:nimHintProcessingNims * fix trunner and avoid need for -d:nimHintProcessingNims * fix some tests
* add `--processing:dots|filenames|off` to customize `hintProcessing` (#17817)Timothee Cour2021-04-233-3/+3
|
* fixed dot operator recursive loop & macro suggest (#16922)Saem Ghani2021-02-152-12/+1
| | | | | | | | | | | | | | | | | | * basic stability improvements; refs nimsuggest * fixed dot operator recursive loop & macro suggest * hacky fix for run away dot operator sem check Committing this mostly to make the issue more clear. Perhaps get better feedback. * semExprWithType seems like a better place to check * fixed error messages const case expressions * Clean-up test * stopped the dot operator madness No longer get infinite recursion when seming broken code with a dot operator macro like in jsffi. Co-authored-by: Araq <rumpf_a@web.de>
* tables module uses runnableExamples (#16994)flywind2021-02-131-0/+2
| | | | | * tables module use runnableExamples * disable the tests
* nimsuggest prioritize non-deprecated suggestions (#16816)Saem Ghani2021-01-292-10/+12
| | | | | | | | | | | * penalizes the quality score of deprecated symbols * uses quality more pervasively in order to reflect deprecation impact * impacts both sug and con additional notes: * linux i386 CI was failing * this is because the suggested results differ slightly in their sort * 64 bit tables.getOrDefault:441 was returned, while 32 bit returned 422 * for now simply removing the last line is good enough
* regression test for nim-lang/nimsuggest#58 (#16817)Saem Ghani2021-01-251-0/+22
| | | Already works this is simply to catch any regressions.
* fixed nim-lang/nimsuggest#48 type aware sug (#16814)Saem Ghani2021-01-252-3/+29
| | | | * suggesting identifiers accounts context over scope (distance) * key takeaway: context fit is prioritized over a heuristics like scope
* fixes nim-lang/nimsuggest#103 con dot exprs (#16657)Saem Ghani2021-01-121-2/+32
| | | | - con calls for dot exprs now returns results - discovered an issue with dot expr results -- documented
* fixed nim-lang/nimsuggest#82 pure enum field sug (#16676)Saem Ghani2021-01-111-0/+18
| | | | - previous code wasn't account for tyEnum being wrapped in tyTypeDesc - now pure enum fields are suggested
* fixes nim-lang/nimsuggest#119 outline includes (#16608)Saem Ghani2021-01-061-2/+8
| | | | | | nimsuggest outline should account for includes, now it does: - the module prefix will be of the module doing the including - the filename will be of the module that was included - adds a test case for it
* nimsuggest: fix and re-enable old tests (#16401)Saem Ghani2020-12-2719-376/+292
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A number of nimsuggest tests were disabled for various reasons, sometimes due to brittleness. These tests have been fixed where needed and most have are now enabled -- details below. The updates are meant to provide better regression coverage for future nimsuggest improvements. To avoid brittleness some tests were refactored. Impact: * test coverage has now increased * faster execution of the test suite * tests are less likely to break due to stdlib changes Re-enabled Test & Test Description: * `tchk1.nim`: check (chk) via nimsuggest works at end of file * `tdot4.nim`: prioritize already used completion * `tinclude.nim`: definition lookup (def) with includes * `tstrutils.nim` -> `tdef2.nim`: test template definition lookup (def) * `tsug_regression.nim`: regression test for [nimsuggest #52](https://github.com/nim-lang/nimsuggest/issues/52) * `ttemplate_highlight.nim`: per the file name * `twithin_macro_prefix.nim`: suggest within a macro with a prefix Tests Not Re-Enabled: * `twithin_macro.nim` still disabled as it doesn't provide a good test signal * EPC highlight tests remain disabled -- requires out of scope tester changes Additional Notes: * todos added in comments for follow-up work
* suggest: try to find the implementation of a symbol when def is used (#15555)alaviss2020-10-141-0/+13
| | | | | * suggest: try to find the implementation of a symbol when def is used * suggest: return all declarations of the symbol on `def`
* Change severity of template instantiation message [backport] (#14526)Danil Yarantsev2020-06-011-0/+13
| | | | | | | * Change severity of template instatiation msg * Add a test * Trailing newline argh
* Fix `compiles` for nimsuggest [backport] (#14527)Danil Yarantsev2020-06-011-0/+8
| | | | * Handle nimsuggest in tryExpr * Added test
* compiler/suggest: highlight squashed operators (#11796)alaviss2020-04-201-0/+11
| | | | | | The operator fetching proc is greedy, so operators such as `%*` in expression `%*{}` can't be highlighted. This commit fixes that.
* fix deprecations and other warnings (#13748)Miran2020-03-251-3/+3
|
* fix .deprecated. object typedef crash (#13643)Andy Davidoff2020-03-161-3/+5
| | | | | * fix .deprecated. object typedef crash * fixup a test that i don't understand * disable the test rather than debug ci
* compiler/suggest: add variable support to `con` (#12569)alaviss2019-11-041-0/+12
| | | This allows for the type of a variable to be retrieved.
* compiler/semtypes: improve lineinfo for exported object fields (#12495)alaviss2019-10-251-0/+11
| | | | | | | The line info should now points to the `a`, not the `*`, like this: a*: string ^ Additionally this fixes nimsuggest's highlighting of exported object fields.
* compiler/semcall: return the correct lineinfo for nkCallStrLit (#12484)alaviss2019-10-241-0/+11
|
* fixes #12125 (#12131)Andreas Rumpf2019-09-061-0/+0
| | | | * fixes #12125
* Allow void macro result (#11286)Arne Döring2019-05-211-1/+1
| | | | | * allow void macro result * add test for void macro result type
* move assertions and iterators out of system.nim (#10597)Miran2019-03-072-3/+2
| | | | | * move assertions and iterators out of system.nim * limit nimsuggest tests to the first 3 suggestions
* compiler/types: correctly generates signature for non-proc types (#10658)alaviss2019-02-131-0/+12
| | | | This makes signatures generated for nimsuggest correctly distinguish template/macro/converter from proc.
* compiler/[msgs, suggest]: improve highlighter accuracy (#10496)alaviss2019-02-072-0/+21
| | | | | | | | | | Previously the compiler would generate suggestions based on the symbol identifier length, but that might not reflect the actual representation of it within the actual source code. This commit implements a simple source scanner for the suggest module to address the problem outlined above. Fixes nim-lang/nimsuggest#24
* suggest: quote operators and keywords on suggestion (#10460)alaviss2019-01-281-0/+10
|
* semcall: correct lineinfo for accquoted symbols (#10461)alaviss2019-01-271-0/+2
|
* compiler/sem: correct macros lineinfo (#10438)alaviss2019-01-241-0/+13
| | | | | | | | | The compiler believes these are where a macro call starts (marked with `^`): m "string" ^ ^ This commit addresses that.
* compiler/sem*: better lineinfo for templates (#10428)alaviss2019-01-233-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * compiler/sem*: better lineinfo for templates Lineinfo for templates is inconsistant across the compiler, for example: doAssert true ^ ^ a[int](10) ^^ ^ The `^` marks where the compiler thinks the template starts. For qualified call, we got the same situation with `proc`s before #10427: system.once ^ Generics lineinfo within template declaration is also incorrect, for example, this is where the compiler believes the `T` in `[T]` is: template a[T](b: T) ^ This PR addresses all of these problems. * nimsuggest: add tests for template highlighting
* nimsuggest/tester: disable highlight tests for epc (#10426)alaviss2019-01-232-2/+0
| | | | The EPC backend of nimsuggest currently doesn't support nimsuggest highlighter, see nim-lang/nim-mode#140
* compiler/sem*: improve lineinfo for qualified and generic procs (#10427)alaviss2019-01-232-0/+27
| | | | | | | | | | | | | | | | Previously the compiler will believe these are where `newSeq` symbol starts: newSeq[int]() ^ system.newSeq[int]() ^ This commit moves them back to: newSeq[int]() ^ system.newSeq[int]() ^
* Correct lineinfo for accent quoted symbols in proc definition (#10399)alaviss2019-01-211-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * compiler/parser: preserve lineinfo for accent quoted symbols Previously the lineinfo for symbol $$$ in this example is: proc `$$$` ^ After this commit: proc `$$$` ^ * compiler/semstmts: correct lineinfo for accent quoted idents Previously nimsuggest would highlight this as: proc `$$$` ^~~ After this commit: proc `$$$` ^~~ * nimsuggest/tests: add a test for accent quoted proc Disabled by default
* fixes nim-lang/nimsuggest#76 (#10093)alaviss2018-12-251-0/+28
| | | | | | | | * nimsuggest: prevent out-of-bound access * fixes nim-lang/nimsuggest#76 * undo tester changes
* add nim c -r nimsuggest/tester to travis (#8805)Timothee Cour2018-08-298-0/+8
|
* cleanup nimsuggest tests a bitAndreas Rumpf2018-08-102-5/+5
|
* fixes #6707; nimsuggest tests still not greenAndreas Rumpf2017-11-085-7/+7
|