Comments (4)
I found the source of pi issue #5 but Iβm undecided about the best way to fix. The problem is the recursion in the code below. I am leery about adding a bool recurse argument as the method as it would be necessary in a chain of methods. I lean towards a another set of methods that donβt recurse. It would mean some method name changes to make it clear which set did the recursion.
// FindNamePrefix looks for given symbol name prefix within this map
// and any children on the map.
// adds to given matches map (which can be nil), for more efficient recursive use
func (sm *SymMap) FindNamePrefix(seed string, matches *SymMap) {
noCase := true
if complete.HasUpperCase(seed) {
noCase = false
}
for _, sy := range *sm {
nm := sy.Name
if noCase {
nm = strings.ToLower(nm)
}
if strings.HasPrefix(nm, seed) {
if *matches == nil {
*matches = make(SymMap)
}
(*matches)[sy.Name] = sy
}
}
for _, ss := range *sm {
ss.Children.FindNamePrefix(seed, matches)
}
}
from pi.
Yep go ahead and add a new set of methods. FindNamePrefixRecursive vs. FindNamePrefix?
from pi.
Yes, that naming is very clear!
from pi.
Done
from pi.
Related Issues (9)
- preserve selection across focus events in gi.TreeView HOT 1
- Consider moving piview out of gide
- potential optimization: map of symbols in long expressions
- figure out why func main() { doesn't match second )
- Completion not finding key.ChordEvent completions HOT 1
- Completion of local vars is adding the method that scopes the var as a possible completion HOT 1
- type not being set HOT 1
- opening gi/font.go causes massive cpu load HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pi.