[ZeroBrane Studio] Re: Remote debugging: IDE project path vs. actual file path

  • From: Paul K <paul@xxxxxxxxxxxxx>
  • To: "zerobrane@xxxxxxxxxxxxx" <zerobrane@xxxxxxxxxxxxx>
  • Date: Fri, 24 Oct 2014 15:30:22 -0700

Hi Jan,

> At the moment I feel that ZBS tries to be smart and fails, and such a case 
> always calls for either making the program even smarter (which can be hard). 
> Or just point it in the right direction, for example by telling it to ignore 
> the paths it gets from mobdebug (I guess?) and just use the files with the 
> same name in the project directory, even if ít thinks the paths don't match.

I generally don't mind, but there are some cons as well. I've been
thinking about adding basename() call for some time (to explicitly set
a basename in your script instead of relying on the one received from
the IDE), but it was exposing too much of debugger internal handling
of the paths, which I wanted to avoid.

You may try something like this: add the following fragment at the end
of mobdebug.lua (before "return")

mobdebug.basedir = function(b) if b then basedir = b end return basedir end

You can then call it from your script with something like
require("mobdebug").basedir([[../../scripts/]]); note that you should
be using "Unix" path separators (even when running on Windows) and
it's one of those things that I'd prefer not to expose.

Basically, this basedir is a path fragment that will be removed from
your filename reported by the Lua interpreter and then combined with
the project path in the IDE to get the file name.

> I know, I got a lot of proposals with this and the extra tooltip window ;)

Thank you for the reminder ;). I actually made the changes I was
planning to make to enable tooltip callbacks (get the latest code from
github) and also added a plugin that you can use as a starting point
(https://github.com/pkulchenko/ZeroBranePackage/blob/master/referencepanel.lua).
When you enable the reference panel (View | Reference Window) all
tooltips will be shown in that window; when it's hidden, the tooltips
are going to be shown normally. You can apply whatever processing you
want to those tooltips; for example, you can replace *foo* with foo
that will be shown using "bold" style (with a bit of Scintilla magic)
and so on. I think it may be enough as a starting point. That
reference window behaves in the same way as all other "additional"
windows in ZBS: outline, document view, stack, watch, etc (although I
made to always be docked; this can be changed).

Paul.

Other related posts: