Sign in to follow this  
Followers 0
lee321987

autocomplete - how to add "closers" (e.g. add "endif" when completing "if")

7 posts in this topic

Hi.

Here's what I'm trying to do in SciTe:

I type "For"

Autocomplete box opens with "For" selected

I hit a hotkey, and the matching "Next" is typed on the next line.

I found a way to do this with "Func", but it only works if I type "Fun" then hit the {SPACE} key. "Fu" {SPACE} doesn't work, nor does "Func" {SPACE}.

Here's what autocomplete types when I type "fun" {SPACE}

Func _()
EndFunc

Id like this for "Do...Until", "While...Wend", ect...

Possible?

Share this post


Link to post
Share on other sites



Hi.

Here's what I'm trying to do in SciTe:

I type "For"

Autocomplete box opens with "For" selected

I hit a hotkey, and the matching "Next" is typed on the next line.

I found a way to do this with "Func", but it only works if I type "Fun" then hit the {SPACE} key. "Fu" {SPACE} doesn't work, nor does "Func" {SPACE}.

Here's what autocomplete types when I type "fun" {SPACE}

Func _()
EndFunc

Id like this for "Do...Until", "While...Wend", ect...

Possible?

Are you talking about the abbreviations option in stead of autocomplete?

When typing fun the text changes to red and then the space will auto expand to whatever is defined in the abbrev.properties file.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I guess I was. I hadn't noticed the red.

Thanks a lot.

Share this post


Link to post
Share on other sites

Very interesting find, typing "fun" and hitting the space key really does gives a prototype for a function.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

here's a stab at it

... works most of the time

Opt("WinTitleMatchMode", 4)

HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "ShowMe")

While 1
    Sleep(100)
WEnd

Func ShowMe()
    $SciTE = '[CLASS:SciTEWindow]'
    $script = StringToBinary(ControlGetText($SciTE, '', '[CLASS:Scintilla; INSTANCE:1]'), 2)
    $script = BinaryToString($script, 1)
    $Split = StringSplit($script, @CRLF)
    $script = $Split[$Split[0]]

    Switch $script ; Add all the inputs you want here
        Case "Do"
            $stext = "Until"
        Case "While"
            $stext = "Wend"
        Case "Func"
            $stext = "EndFunc"
        Case "For"
            $stext = "Next"
        Case Else
            $stext = ""
    EndSwitch

    If $stext <> "" Then ControlSend("classname=SciTEWindow", "", "[CLASS:Scintilla; INSTANCE:1]", @CRLF & $stext & @CRLF & @CRLF)
EndFunc   ;==>ShowMe

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Very interesting find, typing "fun" and hitting the space key really does gives a prototype for a function.

This is the Abbreviations we (Mhz&I) have setup by adding an extra Lexer keyword, a LUA script and the abbrev.properties file.

Its documented in the SciTE4AutoIt3 helpfile that comes with the full install.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

This is the Abbreviations we (Mhz&I) have setup by adding an extra Lexer keyword, a LUA script and the abbrev.properties file.

Its documented in the SciTE4AutoIt3 helpfile that comes with the full install.

Jos

Whoa! I can't believe I missed this. It's beautiful. Thanks.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0