X

Geertjan's Blog

  • September 4, 2010

Lookups.forPath Code Completion

Geertjan Wielenga
Product Manager
Ernest Lotter from the ISSI team in Stellenbosch suggested that "Lookups.forPath" (and other code that looks into the filesystem) should be supported via code completion. Here's a start, on the dot prior to "forPath", when an item is selected, it is added between the quotation marks:

To do:

  • Fix it so that the code completion appears between the quotation marks within the braces, instead of on the dot. (Does anyone know how I should do that?)
  • Extend it so that when the user types "/" afterwards, the code completion pops up again, displaying the children of the selected folder.
  • Provide the folders from the current layer as a priority above those from the whole filesystem, since you're more likely to want to look into a folder you created yourself.
  • Extend the Options window so that the user can specify the code constructs for which this layer-based completion should be available, e.g., also for the one for attaching layer folders to Actions.

Thanks for the idea Ernest, it could end up being pretty cool.


Join the discussion

Comments ( 4 )
  • Tor Norbye Saturday, September 4, 2010

    Regarding how to completion between quotation marks - we do that in many other places, for example in Ruby "require" statements etc; look for RubyStringCompleter in the ruby/ module for example, or look for "completeStrings" in python.editor. The general idea is that in your code completion implementation, you use the lexer to determine whether you're inside a string literal, and you can iterate backwards through the tokens to see if it's the string context you care about.


  • Ernest Sunday, September 5, 2010

    This would be pretty cool indeed yes, but just to clarify, I think this was as much your idea as mine! :-)

    Another gotcha that I thought about - with the introduction of annotation-based action registrations (as well as other annotations that generate entries in the layer), the entries in the layer file would not be generated until compile time, which may be after we actually need them in code completion. Would another TODO on your roadmap be digging into @ActionReferences and @ActionReference once those have become mainstream (6.10)?


  • adam Sunday, September 5, 2010

    This looks like one of the coolest code completions for platform development that I can't believe that I have lived without it! Hope that this gets included in NB 6.10!


  • Jaroslav Tulach Monday, September 6, 2010

    Recently I created live view of the system file system folders for @ActionReference. I like how it is useful. Adding another code completion for Lookups.forPath is going to be very useful too. Go on, put that into apisupport.project!


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.