Giter VIP home page Giter VIP logo

experimental-completion's Introduction

experimental-completion's People

Contributors

guillep avatar jecisc avatar myroslavarm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

experimental-completion's Issues

Pharo8: return empty model for sequence

We check for a number of nodes that we are not intersted in in #createModel. We should add
the sequenceNode, too:

node isSequence ifTrue: [ ^NECEmptyModel new ].

Pharo8: Make a minimal PR with just the code needed for CompletionController

It would be nice if we could add CompletionController already to the image and have people testing it.

it does not need much: CompletionController, CompletionContext, TypingVisitor what else?

The good thing would be that we could test it for real (even make it default for a while)

This could be added to the NECompletion package (in its own Tag, like OCompletion now)

Update Pharo8 with latest completion

there's now a better version of code completion available, with a single model class and a single entry class. it makes sense to implement it into Pharo 8, as it gives an even better idea of the end result of our code completion

Own model class: make it pluggable

The same way that we have CompletionController which defines that it uses CompletionContext
we could add the "we make our own model" version in a way that it is pluggable:

  1. subclass CompletionContext (maybe CompletionContextWithOwnModel)
  2. override there createModel to return our own model
  3. add CompletionController with a method contextClass that returns CompletionContextWithOwnModel

--> the version of the new completion with our own model can be selected in the preferences and we can work on both at the same time

(I feat that the "own model" version will take a bit to get stable, while CompletionContext is very, very usable now)

add method definition competion

the line
(self methodNames includes: aRBMethodNode) ifFalse: [ ^#() ].
in MatchedNodeProducer >> visitMethodNode: aRBMethodNode
gets rid of the incorrect temp definition completion, but also stops method definitions from being completed. we need to figure out a way to fix it

New Model: it is a bit slow

It feels a bit slow.

The reason: we #entries is called a lot. In the old Model it was an instance variable

we should refactor it to be that.

-> lazy init
-> update on narrowWith:

Something like that...

Pharo8: make a PR to remove the OCompletion classes

Ocompletion is about sorting results. We will add an API for that later.

For now everything would be simpler if we could remove the dedicated OCompletion code
(Controller and all the classes in the category)

add test: 1 + (1 si

in the old completion, we get a suggestion for the send.

With the new one, we do not as the parser parses all the faulty code in one parse error node.

First step: add two tests (one for old, one for now) so we do not forget.

To Check: AST seems to be not updated after typing

Right now it seems that we do not create a new AST for the suggestions in some cases, but instead we rely on updating the AST (see narrowWith: on the Node classes).

It might be better to instead update the AST by re-parsing it from source.

It is not really clear what happens in detail, so the first step is to understand the problem better

DNU on <tab>

when pressing we get a DNU #commonPrefix

on a quick read, maybe the method from the old Model will just work if copied over

nodeForOffset: experiment

nodeForOffset: anInteger
| children |
children := self children.
(children isEmpty) ifTrue: [ (self sourceInterval includes: anInteger) ifTrue: [^self]].
children do: [:each | (each sourceInterval includes: anInteger) ifTrue: [^each nodeForOffset: anInteger] ].

testNodeForOffsetAssignment
"test the case of a Assignment"
| source ast foundNode |
source := 'method Object := Class'.
ast := RBParser parseMethod: source.
foundNode := ast nodeForOffset: 9.
self assert: (foundNode class == RBVariableNode).
foundNode := ast nodeForOffset: 14.
self assert: (foundNode class == RBAssignmentNode).
foundNode := ast nodeForOffset: 19.
self assert: (foundNode class == RBVariableNode)

testNodeForOffsetMessage
	"test the case of Messages"
	| source ast foundNode |
	source := 'method Object doit: Class'.
	ast := RBParser parseMethod: source.
	foundNode := ast nodeForOffset: 9.
	self assert: (foundNode class == RBVariableNode).
	foundNode := ast nodeForOffset: 14.
	self assert: (foundNode class == RBMessageNode).
	foundNode := ast nodeForOffset: 22.
	self assert: (foundNode class == RBVariableNode)
	
	
	testNodeForOffsetTempDefinition
		"test the case of Messages"
		| source ast foundNode |
		source := 'method | temp |'.
		ast := RBParser parseFaultyMethod: source.
		foundNode := ast nodeForOffset: 12.
		self assert: (foundNode class == RBVariableNode).

testNodeForOffsetVar
"test the case of a variable"
| source ast foundNode |
source := 'method Object'.
ast := RBParser parseMethod: source.
foundNode := ast nodeForOffset: 9.
self assert: (foundNode class == RBVariableNode)

Coloring: implement TestCompletionEntry>>#type

If we return the right symbols when #type is called on the entry, the User Interface will color the suggestions (e.g. BOLD for classes).

see the implementors of #type in the old Entry hierarchy (e.g it should be #instVar for instance variables).

If the TestCompletionEntry is extended to store the node, it should be easy to implement this.

TestCompletionModel: clazz is UndefinedObject by default

I wonder if using UndefinedObject is really good. e.g. this means we can not destinguish
"we look at UndefinedObject" vs. really having no class set (in the playground).

Can it not just be nil in the case there is no class?

DNU on #completionToken in RBReturnNode

Cyril got it in

needToAdaptTo: aRGClass
    1halt.
    ^ (self generatedTraits as (aRGClass traitComposition traits select: #isMetamodelEntity) and: [ (self generatedSlots collect: #name) = (aRGClass slots collect: #name) ]) not

trying to write self generatedTraits asSet

maybe can be fixed by creating

RBReturnNode >> completionToken
	^ Symbol selectorTable

because i don't think returning an empty string makes sense at this point because we do want a completion

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.