These are chat archives for ensime/ensime-sublime

21st
Jul 2015
Rory Graves
@rorygraves
Jul 21 2015 06:08
Doh, should have spotted this earlier. My last commit on the server addresses this
f4de40f6ce93afa75fd5bbe153c5f1df73035b1a
changed the handling of VoidResponse and fixed a bunch of debugger issues. Check that you server is up to date.
Sam Halliday
@fommil
Jul 21 2015 06:49
I wouldn't trust the server the launch anything in debug mode. I'd really like to see SBT (or at least or plugin) add support for launching forked apps and tests with the remote debugger enabled. But my foo is limited.
Dick Wall
@dickwall
Jul 21 2015 13:43
ah - I had the same thought last night Rory - I am just using the ensime server bundled with the plugin. Literally had this epiphany as I was falling asleep. I will grab the latest and give that a whirl, thanks man
Dick Wall
@dickwall
Jul 21 2015 14:02
anything I should know about running ensime directly rather than from the serverStart.sh script? Is it just a case of running the main method and passing it the .ensime file from the project?
Rory Graves
@rorygraves
Jul 21 2015 14:57
Nothing special - effecitvely the script and you need to run the Server class with -Densime.config="<path to .ensime file>" you can include the java flags from the .ensime as well (-Xss etc).
Or just flush Ensime jars from your .ivy cache. The latest version has the code I'm thinking off in
Rory Graves
@rorygraves
Jul 21 2015 15:02
The start script downloads the latest - but I;ve seen some cacheing issues as we use -SNAPSHOT versions.
Dick Wall
@dickwall
Jul 21 2015 16:16
ah, OK
that'll work
so - my new strategy is to just start using ensime-sublime for everything
for contract work,
when I hit a problem that really irks me, clock out and try and fix it before continuing :-)
I have the spare time for that this month
if nothing else I will be a useful beta tester. I have a good ability to break stuff
Sam Halliday
@fommil
Jul 21 2015 18:57
@dickwall sweet! btw, there is probably easier wins than debugging... semantic highlighting and documentation integration would be a good one to go for. All supported in the server already.
Rory Graves
@rorygraves
Jul 21 2015 21:08
@dickwall awesome stuff. Ignore @fommil He appears to believe that nobody cares about debugging but the evidence says otherwise ;) Obviously we want all the things, but one step at a time. One of the interesting things would be to tell us your biggest pain points when using it so we can all focus our efforts. Semantic highlighting is awesome, but may not be a cheap win.
I'm slowly progressing towards having the 'Ensime: Start' properly bootstrap the project, hopefully have a working prototype in the next few days.
Dick Wall
@dickwall
Jul 21 2015 21:13
I am reminded of the time my very good friend Runar and I had a similar discussion, until I pointed out that a colleague and I found an eagerness bug in scalaz-stream using the debugger in intellij ... :-) Sure, in an ideal world, single step debugging might not be necessary. When we get to that ideal world, I'll let you know, until then...
I am more likely to implement "import class" stuff first, since that is the main one I am hitting right now, unless it's supposed to work already, in which case I am doing something wrong again...
Rory Graves
@rorygraves
Jul 21 2015 21:22
I know the server supports 'import class', I have no idea what state the add import is in within Sublime.
Sounds like a good candidate though
Dick Wall
@dickwall
Jul 21 2015 21:23
might be a good milk run for an end to end fix
oh - well that was easy
it was another one of those list -> iterator things from python 2 -> 3000
PR shortly
and that's huge for my workflow :-)
Dick Wall
@dickwall
Jul 21 2015 21:28
never realized quite how much I leaned on add import
Rory Graves
@rorygraves
Jul 21 2015 21:29
Bonus!
Dick Wall
@dickwall
Jul 21 2015 21:29
yeah - may have spoken too soon - I get the popup now, so that's a help
and no exceptions
but it also doesn't add the line, it just doesn't give an error :-)
it's better than it was, cos now I can see where to import from, but it's like the idea of a cake without the cake
Rory Graves
@rorygraves
Jul 21 2015 21:30
lol, so far I've been splurging print statements everywhere to work out where it falls down in these cases
Did I see you are back over for scala exchange?
Dick Wall
@dickwall
Jul 21 2015 21:31
dunno yet - depends how many signups we get for the training probably
Rory Graves
@rorygraves
Jul 21 2015 21:31
Ah, fair enough
Dick Wall
@dickwall
Jul 21 2015 21:31
ended up quite out-of-pocket for the last one, keen not to repeat that experience as a self employed entrepreneur :-)
but I would like to
Rory Graves
@rorygraves
Jul 21 2015 21:33
yeah, I can understand that issue
Dick Wall
@dickwall
Jul 21 2015 21:33
so - I think I will stick this PR in anyway - it's definitely no worse than it was before
the list of potential imports is half way there, but the actual insertion never occurs
I will track that down when I am not billing :-)
Rory Graves
@rorygraves
Jul 21 2015 21:34
cool, yeah do it
lol, far enough
Dick Wall
@dickwall
Jul 21 2015 21:38
hmm - just did a quick rebase first, and now I get a complaint from the plugin: ImportError: no Module named 'thread'
as far as I can tell that didn't change
oh - bloody idiot
I rebased on master - that's bad :-)
Rory Graves
@rorygraves
Jul 21 2015 21:39
Ah. Check my last commit. I probably broke it.
Dick Wall
@dickwall
Jul 21 2015 21:39
should have been ST3
Rory Graves
@rorygraves
Jul 21 2015 21:40
Lol. Yep that would be bad right now.
Dick Wall
@dickwall
Jul 21 2015 21:40
muscle memory from working on master branches in the billed side of my life - sorry
be along shortly
Rory Graves
@rorygraves
Jul 21 2015 21:41
I'm going to move master to a ST2 branch and make master == ST3 soon. But I need to do a dance with Package Control so I haven't got round to it yet.
Dick Wall
@dickwall
Jul 21 2015 21:42
no worries - I just need to remember that error means I checked out the wrong branch again :-)
well - there we go - I need to update more often - someone already got there :-)
Dick Wall
@dickwall
Jul 21 2015 21:56
you got a minute, this might be a chance for you to teach me to fish :-)
so the popup works, showing the list of imports
after selection it calls back into the handler
Rory Graves
@rorygraves
Jul 21 2015 21:56
Awesome!
Dick Wall
@dickwall
Jul 21 2015 21:56
line 1484 in ensime.py
it calls the rpc to perform the refactor, with the parameters (in my case):
[qualifiedName, 'com.amazonaws.handlers.AsyncHandler', file, '..../AwsScalaFuture.scala', start, 0 , end, 0]
I shortened the file path, but it is correct, if absolute (not sure if that might be a problem)
it's absolute to the root of the FS, not the project directory
so - it calls the RPC with that, and reloads the file, but the refactor fails
Rory Graves
@rorygraves
Jul 21 2015 21:59
self.rpc.prepare_refactor(1, sym('addImport'), params, False, self.handle_refactor_response)
?
Right, what does the refactor result come back with?
Dick Wall
@dickwall
Jul 21 2015 22:00
ah - I was getting the ensime log first:
ImportSuggestionsReq(/home/dick/dev/Stax-as-a-Service/src/main/scala/com.arch/util/AwsScalaFuture.scala,394,List(AsyncHandler),20)
so, lots of crap there, but no exceptions that I can see jumping out
Rory Graves
@rorygraves
Jul 21 2015 22:01
I have a nasty suspicision that the behaviour on the server changed and you need to follow up with a call to exec-refactor
I need to tweak the server logging @fommil s recent changes make it look very pretty but appear to hide most of the info we actually are about.
Dick Wall
@dickwall
Jul 21 2015 22:02
cut that down to what I believe is the important bit
OK - let's get the refactor result
Rory Graves
@rorygraves
Jul 21 2015 22:04
Right - ok - I was right - prepare refactor is now always just tells you what it would do
Dick Wall
@dickwall
Jul 21 2015 22:04
{ 'done': True }
Rory Graves
@rorygraves
Jul 21 2015 22:04
call rpc.exec_refactor(1)
Dick Wall
@dickwall
Jul 21 2015 22:04
that seems pretty good :-)
ah, OK - so after prepare refactor, call the exec_refactor(1)
Rory Graves
@rorygraves
Jul 21 2015 22:05
lol - helpful result there.
Dick Wall
@dickwall
Jul 21 2015 22:05
I'll give that a go :-)
Rory Graves
@rorygraves
Jul 21 2015 22:05
I believe so
Dick Wall
@dickwall
Jul 21 2015 22:05
ah - so the 1 at the beginning of that prepare refactor is an id we assign?
so you can stack them up, more than one refactoring at a time?
Rory Graves
@rorygraves
Jul 21 2015 22:06
I think it should be an different id each time, not sure it breaks anything.
theoretically you can ask it to do and then undo the operations, but it doesn't know about the other file edits so I suspect the implementation is completely broken in certain cases.
Dick Wall
@dickwall
Jul 21 2015 22:07
I just wondered what that 1 was for
OK - so - no exec_refactor on rpc. Do I just add one with a pass to get that reflecto magic?
Rory Graves
@rorygraves
Jul 21 2015 22:08
@fommil and I were discussing the idea that you just hand back the file changes and its up to the client to manage the undo stack
Yes, I believe so
Dick Wall
@dickwall
Jul 21 2015 22:09
OK - so questions piling up for that. Right now the prepare_refactor has the callback that reloads the file
seems to me that the exec_refactor should really do that callback, right?
or should the exec_refactor happen in the callback for prepare (I guess to let it get out of it) and then reload the file?
I think I talked myself into the second one
Rory Graves
@rorygraves
Jul 21 2015 22:10
Second one I believe
prepare -> callback, exec on success -> callback -> reload
oh and the type on the exec call should be sym('addImport') when you get that far ;)
same as the prepare one.
Dick Wall
@dickwall
Jul 21 2015 22:11
ah, so it needs more params than just (1)
I was going to ask that next
Rory Graves
@rorygraves
Jul 21 2015 22:12
case class ExecRefactorReq(procId: Int, tpe: RefactorType) on the server side
right, I'm afraid you are on your own from here on in.... I'm off to the land of nod
Dick Wall
@dickwall
Jul 21 2015 22:12
oh gosh this is exciting :-)
I am learning, I am learning...
Rory Graves
@rorygraves
Jul 21 2015 22:12
good good
Dick Wall
@dickwall
Jul 21 2015 22:13
success!
Rory Graves
@rorygraves
Jul 21 2015 22:14
blimey
Dick Wall
@dickwall
Jul 21 2015 22:14
yeah I know
I feel like I should smoke a cigarette or something, and I don't even smoke :-)
so - not sure I have done it "right" but it works
there is no second callback, it just calls the exec_refactor inside the handle_refactor_response
I think maybe I was lucky that the reload was slower than the refactor since it's all async
Rory Graves
@rorygraves
Jul 21 2015 22:15
lol, and on that happy note, I'm gone, bring on the PR - 'right' is relative it now works (at least last time somebody tried it).
Dick Wall
@dickwall
Jul 21 2015 22:16
but, wouldn't that require the callback be part of the case class?
or is that just done by the reflecto-magic bit?
I'll send the PR in with that question, I suspect it has to be harder than what I did, even if just by a little
but it's worth a PR for now