Commit Graph

103 Commits

Author SHA1 Message Date
Saem Ghani
260a5dacb7 fixed dot operator recursive loop & macro suggest (#16922)
* 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>
2021-02-15 09:51:05 +01:00
flywind
eb8cc51bb8 tables module uses runnableExamples (#16994)
* tables module use runnableExamples
* disable the tests
2021-02-13 09:09:12 +01:00
Timothee Cour
4326f743d0 compilesettings: add libpath (#16997)
* compilesettings: add libpath

* add test

* changelog

* fixup

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-02-12 23:50:41 +01:00
Saem Ghani
1097cc4173 nimsuggest prioritize non-deprecated suggestions (#16816)
* 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
2021-01-29 15:15:35 +01:00
Saem Ghani
0961b5b584 regression test for nim-lang/nimsuggest#58 (#16817)
Already works this is simply to catch any regressions.
2021-01-25 09:52:35 +01:00
Saem Ghani
d99ea00829 fixed nim-lang/nimsuggest#48 type aware sug (#16814)
* suggesting identifiers accounts context over scope (distance)
* key takeaway: context fit is prioritized over a heuristics like scope
2021-01-25 07:36:47 +01:00
Juan Carlos
78a99587a4 Deprecate TaintedString (#15423)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
2021-01-15 18:56:38 -08:00
Saem Ghani
bb3c6d0797 fixes nim-lang/nimsuggest#103 con dot exprs (#16657)
- con calls for dot exprs now returns results
- discovered an issue with dot expr results -- documented
2021-01-12 13:35:21 +01:00
Saem Ghani
bbc96f974d fixed nim-lang/nimsuggest#82 pure enum field sug (#16676)
- previous code wasn't account for tyEnum being wrapped in tyTypeDesc
- now pure enum fields are suggested
2021-01-11 10:18:01 +01:00
Andreas Rumpf
796498525a IC: next steps (#16550)
* cleanups
* ast.nim: cleanups
* IC: no more sym.tab field, stored externally in the module graph
* nimble compiles again
* rodfiles: store bitwidth of integers and the endianness in the cookie because we serialize 'int' directly
* rodfiles: added compilerproc and export sections
* rodfiles: added all the missing sections
* rodfiles: track the missing information
* IC: architecture for lazy loading of proc bodies
* make tests green again
* completed the lazy loading of proc bodies
* symbol lookup integration, part 1
* symbol lookup integration, part 2
* symbol lookup integration, part 3
* make tcompilerapi work again
* rodfiles: fixed config change handling
2021-01-07 20:26:40 +01:00
Saem Ghani
21dfa04cbf fixes nim-lang/nimsuggest#119 outline includes (#16608)
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
2021-01-06 20:26:16 +01:00
Saem Ghani
4cf605dcf6 nimsuggest: fix and re-enable old tests (#16401)
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
2020-12-27 10:08:28 +01:00
flywind
e1e069dd6c use hexchar in stdlib (#16290) 2020-12-17 13:41:05 +01:00
Timothee Cour
52829fc8d1 cmdline: improve command processing (#16056) 2020-11-26 15:55:56 -08:00
Timothee Cour
7815ed69d4 rename loadConfigsAndRunMainCommand => loadConfigsAndProcessCmdLine, reflect reality (#16057) 2020-11-20 10:51:14 +01:00
alaviss
c2ba4ef979 suggest: try to find the implementation of a symbol when def is used (#15555)
* suggest: try to find the implementation of a symbol when def is used

* suggest: return all declarations of the symbol on `def`
2020-10-14 17:08:56 +02:00
Andreas Rumpf
3492178494 refactoring: removed cmdlinehelper.mainCommand callback 2020-10-11 20:44:04 +02:00
Timothee Cour
4301a3da9d * honor --errorMax even for tools (eg drnim, nim doc) (#14546)
* fix a bug that prevented nim doc compiler/nim on windows
2020-06-02 18:54:33 +02:00
Danil Yarantsev
3698f197f1 Change severity of template instantiation message [backport] (#14526)
* Change severity of template instatiation msg

* Add a test

* Trailing newline argh
2020-06-01 17:07:01 +02:00
Danil Yarantsev
00ec43305e Fix compiles for nimsuggest [backport] (#14527)
* Handle nimsuggest in tryExpr
* Added test
2020-06-01 15:06:45 +02:00
Kaushal Modi
bf0e1c696f Remove the uses of {.procvar.} pragma (#14359)
This pragma did nothing.

Ref:
- https://github.com/nim-lang/Nim/issues/2172#issuecomment-383276469
- https://github.com/nim-lang/Nim/issues/12975
2020-05-15 23:37:24 +02:00
alaviss
77834f0fda compiler/suggest: highlight squashed operators (#11796)
The operator fetching proc is greedy, so operators such as `%*` in
expression `%*{}` can't be highlighted.

This commit fixes that.
2020-04-20 11:54:53 +02:00
Miran
5b55aa52d0 fix deprecations and other warnings (#13748) 2020-03-25 19:15:34 +01:00
Jasper Jenkins
1037318e68 fix nimsuggest warning (#13699) 2020-03-20 09:24:04 +01:00
Andy Davidoff
0f672378ab fix .deprecated. object typedef crash (#13643)
* fix .deprecated. object typedef crash
* fixup a test that i don't understand
* disable the test rather than debug ci
2020-03-16 15:08:38 +01:00
alaviss
4bd388ad58 Revert "nimsuggest: don't add CRLF to replies (#13545)" (#13597)
This reverts commit a974684b14.

The CRLF was to separate between each response, and removing them causes
the responses to not be splitted correctly.

I didn't notice that it was in a loop when I made the #13545.
2020-03-06 19:29:28 +01:00
alaviss
a974684b14 nimsuggest: don't add CRLF to replies (#13545)
This is already sent by replTcp after the message is sent.
2020-03-04 15:56:40 +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
Jasper Jenkins
0d022622e3 fix nimsuggest deprecation warnings (#12772) 2019-11-30 06:54:15 +01:00
narimiran
cc3e9ca164 remove unused imports 2019-11-06 12:01:00 +01:00
alaviss
558ecd1ca6 compiler/suggest: add variable support to con (#12569)
This allows for the type of a variable to be retrieved.
2019-11-04 18:29:26 +01:00
alaviss
5b3571c9a4 compiler/semtypes: improve lineinfo for exported object fields (#12495)
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.
2019-10-25 01:06:53 +02:00
alaviss
f827d75804 compiler/semcall: return the correct lineinfo for nkCallStrLit (#12484) 2019-10-24 18:21:37 +02:00
alaviss
f957266574 nimsuggest: add a command that returns the project file (#12411)
This can be used to let nimsuggest users know which project is
nimsuggest being in charge of, so they can know when should a new
nimsuggest instance be spawned.

An additional feature is to debug the project file finding feature.
2019-10-11 18:00:38 +02:00
alaviss
eeffa0163f nimsuggest: add option to force finding the project file (#12409) 2019-10-11 09:55:15 +02:00
alaviss
edb24b7ce0 nimsuggest: fix tcp socket leak for epc backend (#12384) [backport]
Same as e9fa4c9b9c, but for the epc
backend which is used by emacs and vscode plugin.

Since the EPC backend only deal with one connection per nimsuggest
instance, only one socket is leaked, thus not as servere as with the tcp
backend.
2019-10-08 14:14:18 +02:00
alaviss
e9fa4c9b9c nimsuggest: fix tcp socket leak (#12377) [backport]
A new socket is created for each iteration and leak immediately thanks
to the accept() call replacing the created socket with the client socket.

This commit fixes that.
2019-10-08 08:11:18 +02:00
Federico Ceratto
39290cf88c Fix spellings (#12277) [backport] 2019-09-27 07:02:54 +02:00
Andreas Rumpf
8397554315 fixes #12125 (#12131)
* fixes #12125
2019-09-06 07:23:59 +02:00
Araq
cb3c3c306c minor style changes 2019-07-11 00:28:20 +02:00
Miran
6cad5c7861 [bugfix] fix #11482, fix nimsuggest range error (#11519)
The default starting parameters for `line` and `col` were switched.

See line 141: "line starts at 1, column at 0, dirtyfile is optional".
Also, in `TLineInfo` object, `line` is uint16, `col` is int16.
2019-06-17 20:41:41 +02:00
Araq
b70295c768 [other] nimsuggest: adhere to our style guide 2019-06-13 09:59:03 +02:00
Andreas Rumpf
7215341190 make fullpaths the default in error messages and stack traces for mor… (#11385)
* make fullpaths the default in error messages and stack traces for more convenient development
* split up -d:release into -d:release and -d:danger flags
* workaround a Nim config parser bug
* fixes an old nim config parser bug
* make megatest green again
* make nimpretty tests work again
* make nimsuggest green
2019-06-05 08:02:54 +02:00
Araq
dfcd82669b update nimsuggest 2019-05-27 21:29:02 +02:00
Arne Döring
f94ec363ab Allow void macro result (#11286)
* allow void macro result
* add test for void macro result type
2019-05-21 21:31:40 +02:00
Miran
2b5e48d807 move assertions and iterators out of system.nim (#10597)
* move assertions and iterators out of system.nim
* limit nimsuggest tests to the first 3 suggestions
2019-03-07 00:49:39 +01:00
Andreas Rumpf
55bc29c761 nimsuggest: make use project file name if none given for 'sug' command; allows for more convenient debugging 2019-03-04 15:41:07 +01:00
Arne Döring
1102b8ac6e StringStream and parseJson, parseCfg, parseSql et al for the vm (#10746) 2019-02-28 22:57:57 +01:00
Miran
50d1a46537 better docs: osproc (#10708)
* better docs: osproc
* fix a typo in the docs, deprecate "demon"
2019-02-19 17:25:03 +01:00
Miran
8cf97908cc document proper imports, fixes #8164 (#10698) 2019-02-19 12:49:09 +01:00