Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when searching for type, documentation #37

Closed
archaeron opened this issue Jul 4, 2015 · 4 comments
Closed

Error when searching for type, documentation #37

archaeron opened this issue Jul 4, 2015 · 4 comments
Labels

Comments

@archaeron
Copy link
Member

In

plusAssoc : (l, c, r : Nat) -> l `plus` (c `plus` r) = (l `plus` c) `plus` r
plusAssoc Z c r = Refl
plusAssoc (S l) c r = rewrite plusAssoc l c r in Refl

select Nat and do a typesearch.

The package will send Nat) to Idris, resulting in the type not being found.

@archaeron archaeron added the bug label Jul 4, 2015
@david-christiansen
Copy link
Member

That's interesting. When I type search Nat) over the IDE protocol in Emacs, I get:

= Prelude.Nat.Z : Nat
Zero

< Prelude.Classes.minBound : MinBound b => b
The lower bound for the type

The internal communication is:

23:03:09 -> ((:interpret ":search Nat)")
 94)
23:03:09 <- (:output
 (:ok
  (:highlight-source
   ((((:filename "(input)")
      (:start 1 9)
      (:end 1 12))
     ((:name "Prelude.Nat.Nat")
      (:implicit :False)
      (:decor :type)
      (:doc-overview "Unary natural numbers")
      (:type "Type")
      (:namespace "Prelude.Nat"))))))
 94)
23:03:09 <- (:return
 (:ok "= Prelude.Nat.Z : Nat\nZero\n\n< Prelude.Classes.minBound : MinBound b => b\nThe lower bound for the type\n"
      ((0 1
          ((:doc-overview "Result type is isomorphic")))
       (2 13
          ((:name "Prelude.Nat.Z")
           (:implicit :False)
           (:decor :data)
           (:doc-overview "Zero")
           (:type "Nat")
           (:namespace "Prelude.Nat")))
       (18 3
           ((:name "Prelude.Nat.Nat")
            (:implicit :False)
            (:decor :type)
            (:doc-overview "Unary natural numbers")
            (:type "Type")
            (:namespace "Prelude.Nat")))
       (28 1
           ((:doc-overview "Result type is more general than searched type")))
       (30 24
           ((:name "Prelude.Classes.minBound")
            (:implicit :False)
            (:decor :function)
            (:doc-overview "The lower bound for the type")
            (:type "MinBound b => b")
            (:namespace "Prelude.Classes")))
       (57 8
           ((:name "Prelude.Classes.MinBound")
            (:implicit :False)
            (:decor :type)
            (:doc-overview "")
            (:type "Type -> Type")
            (:namespace "Prelude.Classes")))
       (66 1
           ((:name "b")
            (:decor :bound)
            (:implicit :True)))
       (71 1
           ((:name "b")
            (:decor :bound)
            (:implicit :True)))))
 94)

I would actually expect a parse error, rather than getting this back.

@jeremy-w
Copy link

jeremy-w commented Aug 9, 2015

Sounds like an issue with getWordUnderCursor. The getCurrentWordBufferRange() defaults to ::wordRegex, which has an option .includeNonWordCharacters that defaults to true.

Supplying a regex that would match only valid Idris words to getCurrentWordBufferRange(), rather than accepting the default, would likely fix this issue.

@archaeron
Copy link
Member Author

thanks for your pointers, this is helping a lot.
apparently this is the default regex:

/^[  ]*$|[^\s\/\\\(\)"':,\.;<>~!@#\$%\^&\*\|\+=\[\]\{\}`\?\-…]+|[\/\\\(\)"':,\.;<>~!@#\$%\^&\*\|\+=\[\]\{\}`\?\-…]+/g

I just need to understand what it does and change it accordingly :D

@archaeron
Copy link
Member Author

looks fixed. it might need some tweaking, but in my short tests it selected just the Nat in Nat)
and works for things with primes (e.g. abc') too.

thanks @jeremy-w

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants