Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

Builtins are suggested too eagerly #39

Closed
frou opened this issue Jul 16, 2018 · 0 comments · Fixed by #41
Closed

Builtins are suggested too eagerly #39

frou opened this issue Jul 16, 2018 · 0 comments · Fixed by #41

Comments

@frou
Copy link

frou commented Jul 16, 2018

Hi there - Thanks for adding the -builtin flag - it's a good feature.

I notice, though, that builtins seem to be suggested too eagerly in a situation where I wouldn't expect them to be. For example, in the following, the completions false, make, uintptr, etc don't make sense.

2018/07/16 10:38:23 =======================================================
2018/07/16 10:38:33 Got autocompletion request for ''
2018/07/16 10:38:33 Cursor at: 50
2018/07/16 10:38:33 -------------------------------------------------------
package main

import "fmt"

func main() {
    fmt.#

}
2018/07/16 10:38:33 -------------------------------------------------------
2018/07/16 10:38:33 Error parsing input file (outer block):
2018/07/16 10:38:33  6:9: expected selector or type assertion, found ';'
2018/07/16 10:38:33 Elapsed duration: 0s
2018/07/16 10:38:33 Offset: 0
2018/07/16 10:38:33 Number of candidates found: 64
2018/07/16 10:38:33 Candidates are:
2018/07/16 10:38:33   const false untyped bool
2018/07/16 10:38:33   const iota untyped int
2018/07/16 10:38:33   const nil untyped nil
2018/07/16 10:38:33   const true untyped bool
2018/07/16 10:38:33   func Errorf(format string, a ...interface{}) error
2018/07/16 10:38:33   func Fprint(w io.Writer, a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Fprintln(w io.Writer, a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Fscan(r io.Reader, a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Fscanf(r io.Reader, format string, a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Fscanln(r io.Reader, a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Print(a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Printf(format string, a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Println(a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Scan(a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Scanf(format string, a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Scanln(a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Sprint(a ...interface{}) string
2018/07/16 10:38:33   func Sprintf(format string, a ...interface{}) string
2018/07/16 10:38:33   func Sprintln(a ...interface{}) string
2018/07/16 10:38:33   func Sscan(str string, a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Sscanf(str string, format string, a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func Sscanln(str string, a ...interface{}) (n int, err error)
2018/07/16 10:38:33   func append(slice []Type, elems ..Type) []Type
2018/07/16 10:38:33   func cap(v Type) int
2018/07/16 10:38:33   func close(c chan<- Type)
2018/07/16 10:38:33   func complex(real FloatType, imag FloatType) ComplexType
2018/07/16 10:38:33   func copy(dst []Type, src []Type) int
2018/07/16 10:38:33   func delete(m map[Key]Type, key Key)
2018/07/16 10:38:33   func imag(c ComplexType) FloatType
2018/07/16 10:38:33   func len(v Type) int
2018/07/16 10:38:33   func make(Type, size IntegerType) Type
2018/07/16 10:38:33   func new(Type) *Type
2018/07/16 10:38:33   func panic(v interface{})
2018/07/16 10:38:33   func print(args ...Type)
2018/07/16 10:38:33   func println(args ...Type)
2018/07/16 10:38:33   func real(c ComplexType) FloatType
2018/07/16 10:38:33   func recover() interface{}
2018/07/16 10:38:33   type Formatter interface
2018/07/16 10:38:33   type GoStringer interface
2018/07/16 10:38:33   type ScanState interface
2018/07/16 10:38:33   type Scanner interface
2018/07/16 10:38:33   type State interface
2018/07/16 10:38:33   type Stringer interface
2018/07/16 10:38:33   type bool bool
2018/07/16 10:38:33   type byte byte
2018/07/16 10:38:33   type complex128 complex128
2018/07/16 10:38:33   type complex64 complex64
2018/07/16 10:38:33   type error interface
2018/07/16 10:38:33   type float32 float32
2018/07/16 10:38:33   type float64 float64
2018/07/16 10:38:33   type int int
2018/07/16 10:38:33   type int16 int16
2018/07/16 10:38:33   type int32 int32
2018/07/16 10:38:33   type int64 int64
2018/07/16 10:38:33   type int8 int8
2018/07/16 10:38:33   type rune rune
2018/07/16 10:38:33   type string string
2018/07/16 10:38:33   type uint uint
2018/07/16 10:38:33   type uint16 uint16
2018/07/16 10:38:33   type uint32 uint32
2018/07/16 10:38:33   type uint64 uint64
2018/07/16 10:38:33   type uint8 uint8
2018/07/16 10:38:33   type uintptr uintptr
2018/07/16 10:38:33 =======================================================
DisposaBoy added a commit to KurokuLabs/margocode that referenced this issue Jul 19, 2018
Previously, completing `fmt.|` would suggest the builtins

This fixes mdempsky#39
DisposaBoy added a commit to KurokuLabs/margocode that referenced this issue Jul 19, 2018
Previously, completing `fmt.|` would suggest the builtins

This fixes mdempsky#39
DisposaBoy added a commit to KurokuLabs/margocode that referenced this issue Nov 1, 2018
* add support case-insensitive completion

given declarations

	func FunX()
	func funY()

with this enabled, completing `fun|` suggests both functions instead of just `funY`

* Don't suggest builtins when the cursor is in a selector

Previously, completing `fmt.|` would suggest the builtins

This fixes mdempsky#39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant