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

Auto-completion does not work in some cases #17

Closed
gallandarakhneorg opened this issue Mar 11, 2014 · 4 comments
Closed

Auto-completion does not work in some cases #17

gallandarakhneorg opened this issue Mar 11, 2014 · 4 comments
Assignees
Labels
Milestone

Comments

@gallandarakhneorg
Copy link
Member

I want to auto-complete the "Default" in the following code to obtain "DefaultContextInteractions". But the auto-completion mechanism does not work.

agent A {
  use DefaultContext
}

In the following code, the auto-completion works correctly, and the "DefaultContextInteractions" is added into the imports.

agent A {
    on Initialize {
        DefaultContext
    }
}
@gbasso
Copy link

gbasso commented Mar 12, 2014

I have the same problem in this context (with a correct pom) :

import io.sarl.core.Initialize
import io.sarl.core.Destroy

import io.sarl.core.Lifecycle
import io.sarl.core.DefaultContextInteractions
import io.sarl.lang.core.Agent
import org.arakhne.afc.vmutil.Resources

agent XMLAgent {
    uses Lifecycle, DefaultContextInteractions

    on Initialize {
        Resources.getResource() /* this function and every static functions of Resources are not found */
    }
}

@ngaud
Copy link
Member

ngaud commented Mar 20, 2014

Mainly linked with the organize import and scoping issues

@gallandarakhneorg
Copy link
Member Author

I found a problem in our grammar that is the cause why the imports are always marked as "unused".
Indeed, the way we referenced the Capacity, Event, etc. in the grammar does not permits to Xtext to detect the use of these types.
The patch for solving this problem may also solve the "organize import" problem (need to be tested).

gallandarakhneorg added a commit that referenced this issue May 29, 2014
This commit provides the following answers to issues:
* issue #98: the generation of the delegating functions is done one the basis of the JVM objects (in place of the tokens).
* issue #17: the uses of the types are now correctly detected. The import statements are not correctly marked when they are not used. The "organize import" feature is working.
* issue #17: referencing the JVM objects in place of the tokens should permits to the auto-completion feature to detect the proposals.
* issue #92: enforce the code of the JVM inferrer for avoiding a NullPointerException.
* issue #46: write plenty of checking functions in the validator. This avoid the Java compiler to show errors in place of the SARL compiler.
* issue #93: the current grammar, the inferrer, and the validator are now compatible with Xtext 2.6.
@gallandarakhneorg
Copy link
Member Author

The auto-completion feature seems to work better since the last updates in the grammar.

Unfortunately, a minor problem is still here: after selected one of the proposals, the fully-qualified name is put in the code, and these is no import added at the top of the file.

Replacing RawTypeReference by JvmParameterizedTypeReference in the grammar solves the problem (thanks to @srodriguez who gives me the idea to chance this part) :-)

Note that the validator does not need to be updated since it is already checking the type of the elements which used RawTypeReference.

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

4 participants