These are chat archives for ceylon/ceylon-ide-eclipse

8th
Jun 2016
Bastien Jansen
@bjansen
Jun 08 2016 15:12
I think the linked mode is broken in invocation proposals, for example when completing 1.divi
oops no sorry, it was disabled in my settings
wtf
Gavin King
@gavinking
Jun 08 2016 17:27
@davidfestal in intellij, @bjansen uses
ceylonProject.modules?.typecheckerModules.listOfModules
to iterate over all the modules in the workspace
but in Eclipse, I use:
ceylonProject.typechecker.phasedUnits.phasedUnits
and then
ceylonProject.typechecker.context.modules.listOfModules
Which is better?
and, more importantly, which is faster?
David Festal
@davidfestal
Jun 08 2016 17:31
ceylonProject.modules?.typecheckerModules.listOfModules directly gets the modules from the ceylon-model Modules object from the typechecker
so if you are in Java code that seems OK to me
in Ceylon code
Gavin King
@gavinking
Jun 08 2016 17:32
wdym about java code vs ceylon code?
David Festal
@davidfestal
Jun 08 2016 17:33
you can simply use the ceylonProject.modules iterable that wraps typecheckerModules.listOfModules
Gavin King
@gavinking
Jun 08 2016 17:33
so both can be simplified?
David Festal
@davidfestal
Jun 08 2016 17:33
sure
Gavin King
@gavinking
Jun 08 2016 17:33
oh, but this is Java code
on myend
David Festal
@davidfestal
Jun 08 2016 17:34
so the one from @bjansen is the most direct one it seems to me
Gavin King
@gavinking
Jun 08 2016 17:34
What is this getTypecheckerModules() thingy
I don’t see it
David Festal
@davidfestal
Jun 08 2016 17:36
look in CeylonProject.Modules.typecheckerModules
Gavin King
@gavinking
Jun 08 2016 17:38
I am going to try:
    for (IProject project: projectsToSearch) {
        CeylonProject ceylonProject = 
                modelJ2C().ceylonModel()
                    .getProject(project);
        if (ceylonProject != null) {
            for (Module module: 
                    ceylonProject.getModules()
                        .getTypecheckerModules()
                        .getListOfModules()) {
                fillModule(module, 
                        contentProvider, itemsFilter, 
                        monitor, searchedArchives, 
                        projectsToSearch);
                if (monitor.isCanceled()) break;
            }
        }
    }
David Festal
@davidfestal
Jun 08 2016 17:39
OK
Gavin King
@gavinking
Jun 08 2016 17:39
or you think I can just iterate directly over ceylonProject.getModules()?
over javaIterable(ceylonProject.getModules())
David Festal
@davidfestal
Jun 08 2016 17:41
since the Modules iterable is a wrapper on the typecheckerModules.listOfModules
it's going to be very slightly slower
but we don't have milions of modules
soI think it's not really significant
Gavin King
@gavinking
Jun 08 2016 17:42
oh well ok, so it’s the same thing
fine
David Festal
@davidfestal
Jun 08 2016 17:42
The positive thing if you iterate directly on ceylonProject.getModules()
is that you won't have any ConcurrentModificationException
if ever a module were added
since it's copied
    shared actual abstract class Modules() 
            extends super.Modules() 
            satisfies {IdeModuleAlias*} {
        shared formal TypecheckerModules typecheckerModules;

        shared actual Iterator<IdeModuleAlias> iterator() => 
                typecheckerModules.listOfModules
                .toArray(ObjectArray<Module>(typecheckerModules.listOfModules.size()))
                .array.map((m) => unsafeCast<IdeModuleAlias>(m)).iterator();
and it directly returns an IdeModule
that you don't have to cast in your code
Gavin King
@gavinking
Jun 08 2016 17:44
@davidfestal what about CeylonHierarchyContentProvider.collectModules() — would you change that with the new infrastructure?
or leave it as it is (it’s very complicated)
Bastien Jansen
@bjansen
Jun 08 2016 17:45
I might need some of this code when I implement that feature in IntelliJ
David Festal
@davidfestal
Jun 08 2016 17:46
I assume it's not a priority for now
Gavin King
@gavinking
Jun 08 2016 17:46
type hierarchy?
David Festal
@davidfestal
Jun 08 2016 17:47
I mean to migrate to the new infrastructure on the Eclipse side
Gavin King
@gavinking
Jun 08 2016 17:47
no, not a big priority, as long as we make Find Implementors work correctlu
David Festal
@davidfestal
Jun 08 2016 17:47
but
Gavin King
@gavinking
Jun 08 2016 17:47
which it currently doesn't
David Festal
@davidfestal
Jun 08 2016 17:47
when needed for Idea it will be time to move iit to the new infrastructure IMO
Gavin King
@gavinking
Jun 08 2016 17:52
@davidfestal how can I get the project modules efficiently?
w/o iterating over PhasedUnits?
David Festal
@davidfestal
Jun 08 2016 17:53
ceylonProject.modules.fromProject
again it returns an iterable
as opposed to ceylonProject.modules.external
(all the modules that are not project modules)
Gavin King
@gavinking
Jun 08 2016 17:59
@davidfestal when there are x-project deps
are there multiple Module objects for a project module?
or just one
David Festal
@davidfestal
Jun 08 2016 18:00
no
why would there be multiple ?
Gavin King
@gavinking
Jun 08 2016 18:01
well one for the project itself, one for each project that depends on it?
David Festal
@davidfestal
Jun 08 2016 18:01
maybe I didn't understand your question
Ah, OK
then yes, in dependent project this will be an External module
Gavin King
@gavinking
Jun 08 2016 18:01
grr
that makes it more complicated, for sure
David Festal
@davidfestal
Jun 08 2016 18:02
then one loaded from the modules repo of the original project
wait
you have IdeModule.getOriginalModule()
Gavin King
@gavinking
Jun 08 2016 18:02
So I filter them out using:
if ((originalProject == null || 
             !projectsToSearch.contains(originalProject)) 
the dupes, I mean?
David Festal
@davidfestal
Jun 08 2016 18:02
yes, I assume
Gavin King
@gavinking
Jun 08 2016 18:03
is it normal that .getTypecheckerModules().getListOfModules() doesn’t return project modules?
David Festal
@davidfestal
Jun 08 2016 18:04
seems strange to me
Gavin King
@gavinking
Jun 08 2016 18:04
rrm
to me too
and indeed it doesn’t seem to work that way for Bastien in IDEA
David Festal
@davidfestal
Jun 08 2016 18:04
unless a build is being performed
and parseCeylonModel is not finished
Gavin King
@gavinking
Jun 08 2016 18:05
nope, not that
it’s something else
wier
David Festal
@davidfestal
Jun 08 2016 18:05
typecheckerModules returns the Modules object associated to the Context
all this is pure Ceylon tooling
Gavin King
@gavinking
Jun 08 2016 18:06
OIC haha
David Festal
@davidfestal
Jun 08 2016 18:06
so I don't see why it woudn't contain the project modules unless at a time when a new typechecker has been created and ModuleVisitors don't have been called
Gavin King
@gavinking
Jun 08 2016 18:06
the old code prefered to iterate over phasedunits for some reason
I don’t know why
David Festal
@davidfestal
Jun 08 2016 18:07
I don't see why also
Ah, wait
If you want to get phasedUnits, then you have to iterate on :
  • the typechecker phasedUnits for project modules,
  • the phasedUnits of the IdeModule for external modules
it's weird I know
and it's something I'll change once
so you have to do it in 2 steps:
iterate the project source PhasedUnits with typechecker.getPhasedUnits()
and then iterate all the CeylonProject.modules.external and call getPhasedUnits() on them
of course if you only want Unit objects, you can get units fro all modules at once
Gavin King
@gavinking
Jun 08 2016 18:14
@davidfestal is originalProject null for the actual original project module?
David Festal
@davidfestal
Jun 08 2016 18:15
yes
Gavin King
@gavinking
Jun 08 2016 18:15
ok, good
David Festal
@davidfestal
Jun 08 2016 18:15
originalProject is only set if it's a cross-referenced module
Gavin King
@gavinking
Jun 08 2016 18:15
ok, good
and is originalProject ever a non-ceylon project?
David Festal
@davidfestal
Jun 08 2016 18:16
no
Gavin King
@gavinking
Jun 08 2016 18:16
ok
David Festal
@davidfestal
Jun 08 2016 18:17
it doesn't support non-ceylon projects well for now
it's a known limitation
there no CeylonProject object for a non-ceylonproject
Gavin King
@gavinking
Jun 08 2016 18:17
well in this case I’m pretty sure that’s ok
no what I mean is
David Festal
@davidfestal
Jun 08 2016 18:17
it's not part of the overall Ceylon IDE model
Gavin King
@gavinking
Jun 08 2016 18:17
can I have a x-project module
where the project is a non-ceylon project?
oh i guess in principle if it is a Java module, huh?
David Festal
@davidfestal
Jun 08 2016 18:18
no, I don't think so
yeah, but we don't support cross-project dependencies with non-Ceylon project
Gavin King
@gavinking
Jun 08 2016 18:19
well we ever?
David Festal
@davidfestal
Jun 08 2016 18:19
I would like yes, but I have to think at it
Gavin King
@gavinking
Jun 08 2016 18:19
ok
i will leave that code in then
how can I get an IProject from a BaseCeylonProject?
is it possible?
David Festal
@davidfestal
Jun 08 2016 18:22
((CeylonProject<....>)baseCeylonProject).getIdeArtifact()
more precisely
Gavin King
@gavinking
Jun 08 2016 18:22
yew
David Festal
@davidfestal
Jun 08 2016 18:23
((CeylonProject<IProject, IResource, IFolder, IFile>)baseCeylonProject).getIdeArtifact()
The same as what I said earlier: BaseCeylonProject will disappear soon
when I clean all this
since it's there only because I didn't think of using use-site variance in places such as CeylonProjectConfig where I didn't want to add type parameters
I have to go for a while
Gavin King
@gavinking
Jun 08 2016 18:26
ok, so this is getting a lot cleaner now
next i will see if it actually works
David Festal
@davidfestal
Jun 08 2016 18:26
cool. use GTalk if you need some more info :-)
Gavin King
@gavinking
Jun 08 2016 21:36
I have fixed the slow performance of ⇧⌘T in Eclipse, it seems
yaaaay!
David Festal
@davidfestal
Jun 08 2016 21:36
cool, by doing what ?
Gavin King
@gavinking
Jun 08 2016 21:37
by copying the intellij code
what we talked about earlier
David Festal
@davidfestal
Jun 08 2016 21:37
cool
Gavin King
@gavinking
Jun 08 2016 21:37
using the new APis
in CeylonProject
it’s much faster now
David Festal
@davidfestal
Jun 08 2016 21:37
good news :-)
Gavin King
@gavinking
Jun 08 2016 21:37
also, I think your work maybe increased performance of completion? do you think?
David Festal
@davidfestal
Jun 08 2016 21:37
yes, it seems yes
it should
and it seems to me that's the case
Gavin King
@gavinking
Jun 08 2016 21:38
i think I’m experiencing that
David Festal
@davidfestal
Jun 08 2016 21:38
good news also !
Gavin King
@gavinking
Jun 08 2016 21:38
Eclipse is still slow for developing the IDE
simply, i speculate, because it comsumes like 2Gig of ram
And the global locks during rebuilds still suck ass
but I believe you will be able to remove them
David Festal
@davidfestal
Jun 08 2016 21:39
yes, the global lock and the fact that the model cannot be unloaded
Gavin King
@gavinking
Jun 08 2016 21:40
Also the typechecker is really much faster now
15s to type check ceylon-sdk in Eclipse
and 20-something in intellij
(it seems like perhaps eclipse caches some setup info that intellij does not?)
intellij seems to spend a long time before typechecking starts
loading dependencies, it seems
David Festal
@davidfestal
Jun 08 2016 21:42
I worked a whole day to setup a correct lifecycle for the in-editor local typechecking in IntelliJ, to finally realize that my impelementation won't work because of an unfinished implementation in IntelliJ that prevents me adding an analysis pass before another one :-(
yeah, the problem with intelliJ is the module valiating that requires further indexing each time a car is added
or jar
a binary archive
Gavin King
@gavinking
Jun 08 2016 21:43
ok, so that’s those jobs that run at the very start of a model reset?
David Festal
@davidfestal
Jun 08 2016 21:43
yes
indexing
Gavin King
@gavinking
Jun 08 2016 21:43
do we really need to rerun them every time
can their be “partial” model resets if they have not changed?
to avoid re-indexing them?
does that even make sense? :)
David Festal
@davidfestal
Jun 08 2016 21:44
well, the risk is to fail at finding the module descriptor, and end thinking a Ceylon module is a binary module
Gavin King
@gavinking
Jun 08 2016 21:44
i don’t follow that
David Festal
@davidfestal
Jun 08 2016 21:45
it's related to the way the binary modules are resolved during Module validation
during the resolution, the model loader searches for the $module_ class
and if it is not found the module is considered a Java module
but to find this, we must have added the archive of the being-resolved module to the classpath first
add, in intelliJ, being on the classpath (according to the way the model loader works) means being accessible through indexes
=> we have to update indexes before resolving the binary module
but
we could use the alternate resolution mode for this, that allows searching for classes wihtout indexes.
it's slower of course, but for a simple class like this it's not a problem IMO
Gavin King
@gavinking
Jun 08 2016 21:48
the other issue is the missing source attachments
David Festal
@davidfestal
Jun 08 2016 21:49
the thing is that it might miss some classes, and that would be critical
Gavin King
@gavinking
Jun 08 2016 21:49
you have some sophisticated machinery for associating src archives with cars in eclipse
but that doesn’t exist in intellij
David Festal
@davidfestal
Jun 08 2016 21:49
yes
Gavin King
@gavinking
Jun 08 2016 21:49
and it’s annoying
David Festal
@davidfestal
Jun 08 2016 21:49
I've heard of this
I can't believe that there would be nothing to do
David Festal
@davidfestal
Jun 08 2016 21:58
though for the moment I'd like to finish with the local typechecking stuff