Commit Graph

58 Commits

Author SHA1 Message Date
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
alaviss
9e754c3b06 compiler/types: correctly generates signature for non-proc types (#10658)
This makes signatures generated for nimsuggest correctly distinguish
template/macro/converter from proc.
2019-02-13 23:30:14 +01:00
alaviss
d64e218abd nimsuggest: only log when logging is enabled (#10646)
fixes #6199
2019-02-13 23:30:14 +01:00
alaviss
2fdf816332 compiler/[msgs, suggest]: improve highlighter accuracy (#10496)
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
2019-02-07 17:08:15 +01:00
alaviss
74a7b09412 suggest: quote operators and keywords on suggestion (#10460) 2019-01-28 09:29:49 +01:00
alaviss
0b02241fc5 semcall: correct lineinfo for accquoted symbols (#10461) 2019-01-27 14:58:10 +01:00
alaviss
d72921ecf6 compiler/sem: correct macros lineinfo (#10438)
The compiler believes these are where a macro call starts (marked with
`^`):

    m "string"
    ^ ^

This commit addresses that.
2019-01-24 12:22:19 +01:00
alaviss
35d96d8749 compiler/sem*: better lineinfo for templates (#10428)
* 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
2019-01-23 16:35:34 +01:00
alaviss
2fb8b1d132 nimsuggest/tester: disable highlight tests for epc (#10426)
The EPC backend of nimsuggest currently doesn't support nimsuggest
highlighter, see nim-lang/nim-mode#140
2019-01-23 09:43:11 +01:00
alaviss
e962be8981 compiler/sem*: improve lineinfo for qualified and generic procs (#10427)
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]()
           ^
2019-01-23 09:24:21 +01:00
alaviss
413755fd45 Correct lineinfo for accent quoted symbols in proc definition (#10399)
* 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
2019-01-21 16:57:48 +01:00
alaviss
fc30cf02bc nimsuggest: add an option to bind to a free port (#10328) 2019-01-16 21:06:32 +01:00
alaviss
58d293d6a9 fixes nim-lang/nimsuggest#76 (#10093)
* nimsuggest: prevent out-of-bound access

* fixes nim-lang/nimsuggest#76

* undo tester changes
2018-12-25 21:08:16 +01:00
PMunch
3f546b70ed Moved some code around in nimsuggest to avoid crash when run as library (#9818)
* Moved some code around in nimsuggest to avoid crash when run as library

* Moved the common executecallback setting to a procedure

* Fixed slight issue
2018-12-01 09:38:18 +01:00
PMunch
a20169af91 Made nimsuggest importable as a library and add Nim-path override option (#9784)
* Made nimsuggest importable as a library and add Nim-path override option

* Remove leftover debug output
2018-11-23 15:45:48 +01:00
Timothee Cour
fe2eb25650 nimsuggest: fixes #96 2018-11-20 22:57:27 +01:00
Timothee Cour
6e003eeecb refs #9637 ; cleanup installation of nimsuggest (#9703) 2018-11-15 10:02:34 +01:00
Timothee Cour
08de33a2e3 remove ---path:"../compiler" from nimsuggest/nimsuggest.nim.cfg 2018-11-07 19:52:11 +01:00
Andreas Rumpf
86556ebfdb compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
Timothee Cour
ed0cb7b85d make config.nims behave like nim.cfg in terms of where these scripts are searched / run (#8682)
* run project config.nims if exists, then inputfile.nims if exists
* ~/.config/nim/config.nims can now be used
* also check in getSystemConfigPath for config.nims
* refactor handleCmdLine for nim and nimsuggest
2018-08-30 13:52:32 +02:00
Timothee Cour
01211ced1d add nim c -r nimsuggest/tester to travis (#8805) 2018-08-29 16:03:16 +02:00
Andreas Rumpf
7f49364fd0 make more tests green 2018-08-13 12:29:03 +02:00
Andreas Rumpf
28c709fa84 cleanup nimsuggest tests a bit 2018-08-10 09:37:41 +02:00
Andreas Rumpf
5348fef003 implements a --nep1:on switch to make the compiler enforce the naming conventions outlined in NEP-1 2018-06-13 01:44:19 +02:00
Andreas Rumpf
826c1e2d78 incremental compilation: implemented basic replay logic 2018-06-02 09:41:27 +02:00
Andreas Rumpf
688c54d8f1 compiler API: final cleanups; improve security by diabling 'gorge' and friends 2018-05-29 09:07:24 +02:00
Andreas Rumpf
382bc34f93 vm now free of global variables 2018-05-28 14:41:49 +02:00
Andreas Rumpf
40ec7be45c refactoring: remove idents.legacy global variable and pass the IdentCache around explicitly 2018-05-27 22:09:15 +02:00
Andreas Rumpf
669a564492 remove more global variables in the Nim compiler 2018-05-27 11:10:56 +02:00
Andreas Rumpf
bf6c2c5ccf preparations of making compiler/msgs.nim free of global variables 2018-05-17 15:21:22 +02:00
Andreas Rumpf
1616c6e029 make nimsuggest compile again 2018-05-14 13:04:18 +02:00
Andreas Rumpf
e4c088721a make nimsuggest compile again 2018-05-13 09:53:00 +02:00
Andreas Rumpf
ee366f1746 .experimental can now be used to enable specific features 2018-04-24 09:34:29 +02:00
skilchen
e336e6609c include help short option in processCmdLine (#7515) 2018-04-06 09:48:03 +02:00
Araq
a0b547001b nimsuggest: do not execute the .nims file when requested to auto-complete it 2018-03-22 15:51:23 +01:00
pqflx3
c039bbf6e1 Fixed printing nimsuggest commandline help message (#6863) 2017-12-02 20:40:00 +01:00
Andreas Rumpf
ab1787e7db fixes #6707; nimsuggest tests still not green 2017-11-08 11:41:05 +01:00
Fabian Keller
7c03c882f5 Remove more usages of unary lt (fixes #6634) (#6641)
* fixes #6634

* remove more usages of unary <
2017-10-31 19:48:01 +01:00
Federico Ceratto
034e6a3468 Fix spelling error (#6349) 2017-09-15 10:49:57 +02:00
Andreas Rumpf
1a29069ece attempt to make nimsuggest work with choosenim 2017-05-11 17:00:50 +02:00
Andreas Rumpf
ab3f22fce1 minor update for nimsuggest 2017-04-06 08:53:31 +02:00
Arne Döring
3d4f68c822 Make nimsuggest quit when pressing Ctrl-D from the command line. (#5662) 2017-04-06 08:16:26 +02:00
Araq
3962c6339f nimsuggest: die with a project dir/file that doesn't exist 2017-03-21 13:09:57 +01:00
Andreas Rumpf
f7d760cb94 nimsuggest: when invoked with a directory, detect the main nim file on its own 2017-03-14 12:28:15 +01:00
Andreas Rumpf
b414806e66 nimsuggest: suggest types in a type section 2017-03-14 11:21:35 +01:00
Andreas Rumpf
c149a235e7 nimsuggest: make test green again 2017-03-14 10:23:23 +01:00