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

Scide/autocomplete help #1333

Merged
merged 20 commits into from
Mar 21, 2015

Conversation

vdonnefort
Copy link
Contributor

Here's a new feature for scide. This PR adds help informations about selected class when showing autocomplete menu.

There is no intends to modify the file name. It can be set const.

The aim of this patch is to prepare the scdoc support into scide.
This patch allows scide to call scdoc functions such as scdoc_parse_file(). It
adds a scdoc_log.cpp file to implement error() and post() functions needed by
scdoc.

The aim of this patch is to prepare the autocompleter help: the display of
additionnal help (description, summary, examples) when completing classes.
This patch switch the CompletionMenu class from the autocompleter.cpp file to
its own files in order to set it as a Q_OBJECT and use its own signals. This
patch also registers the completion_menu.hpp file into the ide_moc_hdr list.

The aim of this patch is to prepare the autocompleter help: the display of
additionnal help (description, summary, examples) when completing classes.
This patch allows the scide autocompleter to use scdoc to look for informations
such as classes description or summary.

The aim of this patch is to prepare the autocompleter help: the display of
additionnal help (description, summary, examples) when completing classes.
This patch allows completion_menu to display additional infos at the right of
the completion list.

The aim of this patch is to prepare the autocompleter help: the display of
additionnal help (description, summary, examples) when completing classes.
This patch allows scide to display additionnal help during class autocomplete:
  - class summary
  - class description
  - class examples
@muellmusik
Copy link
Contributor

This is great @vdonnefort! A few thoughts:

  • I notice a slight lag after selecting a class and then pressing '.' (debug build)
  • Should this be optional?
  • For readability, there is probably the need to respect a little more formatting (e.g. note::). Of course it doesn't have to render like the help files.
  • A button to jump to the proper help file in the help browser would be nice.
  • Can we have this for method completion too? :-)

I've been thinking about this sort of application ever since we first started discussing scdoc! Thanks!!

@vdonnefort
Copy link
Contributor Author

Hi @muellmusik,

Thank you for your review.

  • I noticed it too, but It doesn't seems related to my patch set. When I
    removed them, I still saw the problem. Can you check that?
  • Tell me if you prefer to have an option to deactivate this feature.
  • What do you mean about "a little more formatting", can you give me an
    example?
  • I will have a look on how to update the help browser and your remark
    about method completion.

@bagong
Copy link
Contributor

bagong commented Mar 16, 2015

This is cool, but it might get in the way of people who want to write quickly, so I also think it should be optional.
I too notice a significant lag at the . (Release mode) that I never noticed before.
Thanks!

@jleben
Copy link
Member

jleben commented Mar 16, 2015

If this introduces any lag, it could be solved by displaying the autocomplete window containing completion suggestions immediately, and load the help text into the window when it becomes available (waiting for it asynchronously, without blocking the main thread).

The adapt() function allows to resize the item list according to the widest.
It remplaces the call of the resize at each addItem() which can lead to a
small lag.
This option allows to activate or not additional infos displayed by the
completion menu.
@vdonnefort
Copy link
Contributor Author

I've just added:

  • a fix for the small lag we talked previously.
  • an option to show/hide this feature.

@muellmusik, can you tell me more about "formating"?

Does anyone has comments about my coding choices?

@bagong
Copy link
Contributor

bagong commented Mar 17, 2015

Nice!

…wser

The QTextBrowser class adds support for hypertext navigation.
This signal is emitted when a clickable information (mostly an HTML anchor) has
been clicked.
This patch adds a link at the end of additional infos displayed with completion
menu. This link opens the related page into the help browser.
@vdonnefort
Copy link
Contributor Author

I've just added:

  • link to the help browser

Open points left:

  • the @muellmusik "formating" remarks for which I need more informations
  • code review?
  • same thing for method completion: It is a bit more complicated, I'd prefer do that into a separated PR later.

@muellmusik
Copy link
Contributor

the @muellmusik "formating" remarks for which I need more informations

Sorry for slow reply, I've been travelling. I mean a little more rendering of the structure, etc.

If you look for instance at OSCdef, the note::...:: is presented as the same paragraph as the description, with no space between. Indeed, paragraph breaks seem not to be respected at all. Server looks pretty bad because of this.

Similarly, subheadings in the description are not rendered, and just get squished in.

Links are presented with the scdoc syntax instead of the link text.

I think this makes it look a little unpolished and needs fixing before it should go in a release.

This patch allows the autocompleter to translate NOTE and LINK IDs into HTML. It
improves the autocompleter help rendering during class completion.
@vdonnefort
Copy link
Contributor Author

@muellmusik This problem is fixed by the last commit.

@muellmusik
Copy link
Contributor

@muellmusik This problem is fixed by the last commit.

Thanks, but I just looked, and not entirely. Subsections are still squished without spacing or formating. Anchor links within the same doc show up with scdoc syntax. You can see this with Server help. code:: tags are also ignored.

This is a great feature though, and thanks for all the work!

This patch fixes the string comparison introduced by:
  scide: autocompleter: interpret SCDoc "NOTE" and "LINK" IDs
This patch allows the autocompleter to translate CODE and CODEBLOCK IDs into
HTML. It improves the autocompleter help rendering during class completion.
This patch allows the autocompleter to deal with local links (#) when parsing
SCDoc.
@vdonnefort
Copy link
Contributor Author

@muellmusik Fixed!

Once again, thank you for testing!

@muellmusik
Copy link
Contributor

Okay, looks very good now!

Two minor things for the future:

  • files which do not have an examples section perhaps should not show the 'Examples' heading.
  • syntax colourising would be cool.

But I'm very happy to merge this as is.

This patch removes the "Example" title if there is no example available into
SCDoc for autocomplete help.
@vdonnefort
Copy link
Contributor Author

@muellmusik I fixed the Examples title.

I have however no clue for syntax colourising for now

@bagong
Copy link
Contributor

bagong commented Mar 18, 2015

Formatting and links are very nice! But now I get this issue: The links to help seem to open a help-page based on the assumption that the/a help-pane is already open (and visible). If that is not the case, indexing help is triggered but no page opens. Also if the help pane is in the background (detached and possibly covered by other windows) - the correct help-page will be loaded, but the pane does not come to the foreground.

This patch allows to force the help dock to be displayed when clicking on a help
link.
@vdonnefort
Copy link
Contributor Author

@bagong, it must be fixed. The last patch force the help dock to focus. Thanks for report

@bagong
Copy link
Contributor

bagong commented Mar 18, 2015

Sorry, this changes nothing for me. Does it work for you, did you try it out?

There are two issues:

  • opening the help docklet if it is completely closed
  • bringing it to the foreground if it is not closed but covered by other Windows

Maybe unrelated but worth a mention: it used to be possible to switch between main window and detached help window (and post Window) by pressing the switch windows key on Mac (on the German keyboard its cmd-`, I forgot what it is on the US keyboard) - this doesn't work atm

@vdonnefort
Copy link
Contributor Author

@bagong, check if you applied correctly the patch on your side because on mine,
it works with both case you described :)

@bagong
Copy link
Contributor

bagong commented Mar 18, 2015

Yea, the commit is in the log...

Are you on Qt4?

I just looked a bit into the new Quarks system and there the same phenomenon: you press a button to open a specific scdoc page and it works if the help pane is open but it does nothing, if it is closed. It also does not bring the help window to the foreground if it is covered by other windows.
In case of Quarks it is pretty disruptive to the workflow: detach help and put it behind the editor-window. Open Quarks, select a Quark, click classes, click help. Now try to bring the helpfile to the foreground manually. It's not easy and cmd-d seems also not to work in this context. Among sclang-windows, btw, "switch-application-window" works.

@vdonnefort
Copy link
Contributor Author

@bagong, I'm using Qt4.8. I tested it on OSX 10.9 and Ubuntu 14.10

@bagong
Copy link
Contributor

bagong commented Mar 18, 2015

Well, then it is likely a quite general Qt5 issue. Would be nice if somebody else on Qt5 compared. Should I file an issue?

Btw, why don't you switch to latest master? Would make sense as your stuff will be committed to a SC version that can only work with Qt5.

@vdonnefort
Copy link
Contributor Author

@bagong I don't think so, it's working on my side using Qt5.

This patch lets the completion_menu use show() and hide() functions instead of a
null size to display or not the additional infos. This allows to have a better
looking completion_menu when there is no additional infos.
@bagong
Copy link
Contributor

bagong commented Mar 19, 2015

I am not sure why :), but now it works as expected for me here. Help window comes to front in all cases!

(not in Quarks though)

@muellmusik
Copy link
Contributor

Shall we merge then?

@bagong
Copy link
Contributor

bagong commented Mar 21, 2015

Just saw that it conflicts with @scztt 's branch topic/ui-refresh in the autocompleter. Maybe wait for him to comment?

@scztt
Copy link
Contributor

scztt commented Mar 21, 2015

@bagong - don't worry about it. that branch is a ways from being mergable, and in any case merging the autocompleter changes from that is easy.

👍 to merge.

@scztt
Copy link
Contributor

scztt commented Mar 21, 2015

Actually - merge now, I'm going to mark 3.7-alpha0 in a bit, and it would be good to have this in for feedback :)

muellmusik added a commit that referenced this pull request Mar 21, 2015
@muellmusik muellmusik merged commit 18b1399 into supercollider:master Mar 21, 2015
@bagong
Copy link
Contributor

bagong commented Mar 24, 2015

Just found another issue: help files from locations integrated via LangConfig are not found. This used to be the case for general scdoc too, but has been fixed here: c48d5d6

Is this the right place to report this, or should I file a general issue as this is in master now?

sofakid pushed a commit to sofakid/supercollider that referenced this pull request Apr 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants