Jump to content
Sign in to follow this  
Angus

how can i enable SciTE4AUTOIT3's function in other languages?

Recommended Posts

Angus

SciTE4AUTOIT3 is powerful in editing AU3 script, i love the autocomplete function of it .

sometimes i need to write with other language, i still need these function but it did not work at all, to expand an abbreviation i have to press "ctrl+B", whill in AU3 script both "space" and "ctrl+B" would work.

can anyone tell me how to let "space" expand (replace "ctrl+B") works in all files??

Edited by Angus

Share this post


Link to post
Share on other sites
Jos

This LUA function (found in AutoItTools.lua) is the trigger for the Abbreviation expand function by typing a SPACE.

function AutoItTools:OnChar(c)
--~   print("Char:" .. c)
    if editor.Lexer == SCLEX_AU3 then
        -- set propercase 
        if props['proper.case'] == '1'  then
            self:ProperCase(c)
        end
        -- abbreviations logic will auto expand on space when SCE_AU3_EXPAND. written by Jos van der Zande (JdeB)
        local ls = editor.StyleAt[editor.CurrentPos-2]
        if ls == SCE_AU3_EXPAND and c == " "  then
            self:Abbreviations()
        end
    end
end -- OnChar()

As you can see the logic tests for when a SPACE is typed AND the Style of the current word is equal to"SCE_AU3_EXPAND".

This style is assigned by the au3lexer and it looks at the table with keywords defined in au3.keywords.abbreviations.properties.

Hope I didn't confuse you too much but this should get you started to look at adapting it to another language.

Jos muttley

Edited by Jos

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

Share this post


Link to post
Share on other sites
Angus

thanks for the reply :(

seems confusing but i got the idea :) muttley

is this mean after i add my own abbreviations to both u3.keywords.abbreviations.properties AND abbreviations.properties, will get things done?

sorry...i'm new to both Autoit3 and SciTE :P

Share this post


Link to post
Share on other sites
Jos

thanks for the reply :(

seems confusing but i got the idea :) muttley

is this mean after i add my own abbreviations to both u3.keywords.abbreviations.properties AND abbreviations.properties, will get things done?

sorry...i'm new to both Autoit3 and SciTE :P

Nope its not that simple.

The issue is that there probably isn't a separate Style available in the other lexers like I created in the AU3 lexer and I don't think you would want to try and expand the words typed every time you hit the space-bar?

Jos


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

Share this post


Link to post
Share on other sites
Angus

Nope its not that simple.

The issue is that there probably isn't a separate Style available in the other lexers like I created in the AU3 lexer and I don't think you would want to try and expand the words typed every time you hit the space-bar?

Jos

Then how to create separate Style in the other lexers? i mean which files should i edit besides the above 2?

ALSO i notice that the SciTE4AutoIt3 autocomplete symbols automatically when i start typing, while in editing other languages it autocompletes symbols only after i press "ctrl+i", so how this works?

i found this in the "lua\AutoItAutoComplete.lua"

-- Show AutoComplete if it isn't showing already.
        if not editor:AutoCActive() then
            scite.MenuCommand(self.IDM_COMPLETE)
            -- fall through
        end

but i try removing the "lua" folders, that disables "space" expand but autocomplete symbols still works automatically. i'm just curious about how you add this function :P

Edited by Angus

Share this post


Link to post
Share on other sites
Angus

up :P

Share this post


Link to post
Share on other sites
Jos

Adding a Lexer type will require you to download the scilexer source and update the appropriate lexer which are written in C++. This means you will create/maintain your own version of that language lexer and generate scilexer.dll.

To support the space for abbrevs and the Auto popup of the autotcomplete stuff you will have to have a closer look at the provided LUA scripts.

Jos

Edited by Jos

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

Share this post


Link to post
Share on other sites
Angus

Adding a Lexer type will require you to download the scilexer source and update the appropriate lexer which are written in C++. This means you will create/maintain your own version of that language lexer and generate scilexer.dll.

To support the space for abbrevs and the Auto popup of the autotcomplete stuff you will have to have a closer look at the provided LUA scripts.

Jos

Thanks :P

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  

×