1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Solved Sublime KSP Code Completion

Discussion in 'Scripting Workshop' started by mindblower23!, Sep 16, 2021.

  1. mindblower23!

    mindblower23! NI Product Owner

    Messages:
    40
    Hi!

    I'm pretty sure I missed something, but I don't get code completion with my declared variables. It seems to work fine with function names and built in variables though ... do I need some prerequisites? Maybe any packages to get that thing running?

    (Sorry, I'm new to sublime text)

    Many thanks in advance for your help!
     
    Last edited: Sep 16, 2021
  2. corbo-billy

    corbo-billy NI Product Owner

    Messages:
    652
    • Like Like x 1
  3. mindblower23!

    mindblower23! NI Product Owner

    Messages:
    40
    Thank you corbo-billy! I've tried to uninstall and reinstall the ksp package but still no code completion for declared variables...
     
  4. mindblower23!

    mindblower23! NI Product Owner

    Messages:
    40
    I've stopped using the variable prefixes like $ etc. and now the auto completion seems to work fine. The only thing that's still not working is the completion for the event handlers like "on note" etc. But maybe this is the normal behaviour?
     
  5. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    For "on note" etc you should use snippets. you type "onn" and press Tab and it automatically creates the callback for you. There are plenty other snippets that do this sort of thing. Very useful.
     
  6. mindblower23!

    mindblower23! NI Product Owner

    Messages:
    40
    Do I need to enable snippets in any way? If I type "onn" there is no callback suggestion for me, see screenshot ...

    Screenshot 2021-09-18 at 12.13.29.png
     
    Last edited: Sep 18, 2021
  7. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Ahh sorry, the trigger for "on note" callback is ncb not onn.

    Snippets are always there, you don't need to activate them. There's 51 snippets for SublimeKSP, and you can check what their triggers are directly in SublimeKSP repository.
     
  8. mindblower23!

    mindblower23! NI Product Owner

    Messages:
    40
    Thx ED! Unfortunately "ncb" also doesn't do the trick for me ...

    Screenshot 2021-09-18 at 17.01.20.png

    Any idea what else could be going wrong here? Shouldn't there be some SublimeKSP related files in the packages folder?

    Screenshot 2021-09-18 at 17.05.00.png
     
  9. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Huh, no idea. SublimeKSP extension is in one file (which is basically a renamed ZIP archive), all the snippets should be in there... Works fine here.
     
  10. mindblower23!

    mindblower23! NI Product Owner

    Messages:
    40
    Ok, I found a way to use the snippets when I type the snippet trigger, dismiss the auto completion list with "esc" and then hit "tab". Do you see the snippet short cuts in the auto completion list? This is really strange behaviour. Looks like it has to do with some funny "tab" keybindings in the default preferences of the current sublime text version. I did a clean install by removing all the preferences files in the library/application support folder ...
     
  11. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Yeah I do see snippets in the completion list...

    upload_2021-9-19_1-40-4.png
     
  12. mindblower23!

    mindblower23! NI Product Owner

    Messages:
    40
    That's weird .. May I ask which os you're on and which sublime build you use?
     
  13. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Windows, Sublime Text 3.2.2 build 3211.
     
  14. mindblower23!

    mindblower23! NI Product Owner

    Messages:
    40
    I've downgraded from Sublime Text 4 to Sublime Text 3 and now it looks like it's working as it should. o_O I'm on a Mac btw.