Nutster Posted July 6, 2004 Share Posted July 6, 2004 How can I prevent the auto-compeletion of words while I am entering a comment or inside a string literal? It is useful when I am typing in code, but a pain in the @$$ when I entering comments or strings. Is there a way to tell SciTE not to auto-complete in strings and comments? David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
CyberSlug Posted July 6, 2004 Share Posted July 6, 2004 Auto-complete also annoys me..... I think I might have PM'ed JdeB about this once. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Developers Jos Posted July 6, 2004 Developers Share Posted July 6, 2004 Yeap you did... and i replied something like:"Do as I... watch your fingers while your typing and just keep on typing".. seriously, maybe you guys need to post something at the scite-interest site about this and see what they say :http://mailman.lyra.org/mailman/listinfo/scite-interest SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valik Posted July 6, 2004 Share Posted July 6, 2004 Hmm, wonder if Lua has an answer... Link to comment Share on other sites More sharing options...
Developers Jos Posted July 6, 2004 Developers Share Posted July 6, 2004 Hmm, wonder if Lua has an answer...You mean something like "while in comment switch off autocomplete" in the OnChar event? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
SlimShady Posted July 6, 2004 Share Posted July 6, 2004 Still... I would like to turn off that feature completely. Link to comment Share on other sites More sharing options...
Valik Posted July 6, 2004 Share Posted July 6, 2004 You mean something like "while in comment switch off autocomplete" in the OnChar event? Something like that, yes. This is totally pseudo and could be wrong, still doing research on it: function OnChar(c) ls = editor.LineState if ls == SCE_AU3_COMMENTBLOCK or ls == SCE_AU3_COMMENT then if scite.SendEditor(SCI_AUTOCACTIVE) then scite.SendEditor(SCI_AUTOCCANCEL) end end end That is totally untested and there could be multiple misunderstandings in my interpretation of the Lua docs and functions/properties. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 6, 2004 Developers Share Posted July 6, 2004 Still... I would like to turn off that feature completely.What feature ? autocomplete ?if thats what you want then just add this to the Users settings file:autocomplete.au3.start.characters= SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valik Posted July 6, 2004 Share Posted July 6, 2004 (edited) After much dumbass-ing around, I have something that works, although it's somewhat dangerous at the moment (I'll fix it soon). The danger comes in if you edit any other documents and the current style happens to match AutoIt's comment styles, you won't get auto-complete.function OnChar(c) -- At this time, AutoIt's lexer is 60, this is unlikely to change. if editor.Lexer ~= 60 then return false end ls = editor.StyleAt[editor.CurrentPos] if ls == SCE_AU3_COMMENTBLOCK or ls == SCE_AU3_COMMENT then if editor:AutoCActive() then editor:AutoCCancel() end return true -- The key is here, this says don't process any more. end endFor the curious, the dumbass-ing came with my lack of knowledge of Lua and thus, I couldn't figure out how to correctly use editor.StyleAt for the LONGEST time.Edit 1: Oh, for those who don't know how to use this, place it in your lua startup script. By default, it's called "SciTEStartup.lua" and is in SciTE's installation directory. (Coming soon will be a fix to make sure this only works with AutoIt files)Edit 2: Fixed code so it should only work when the AutoIt lexer is running. Edited July 6, 2004 by Valik Link to comment Share on other sites More sharing options...
Developers Jos Posted July 6, 2004 Developers Share Posted July 6, 2004 (edited) After much dumbass-ing around, I have something that works, although it's somewhat dangerous at the moment (I'll fix it soon). The danger comes in if you edit any other documents and the current style happens to match AutoIt's comment styles, you won't get auto-complete. function OnChar(c) ls = editor.StyleAt[editor.CurrentPos] if ls == SCE_AU3_COMMENTBLOCK or ls == SCE_AU3_COMMENT then if editor:AutoCActive() then editor:AutoCCancel() end return true -- The key is here, this says don't process any more. end return false end For the curious, the dumbass-ing came with my lack of knowledge of Lua and thus, I couldn't figure out how to correctly use editor.StyleAt for the LONGEST time. Edit 1: Oh, for those who don't know how to use this, place it in your lua startup script. By default, it's called "SciTEStartup.lua" and is in SciTE's installation directory. (Coming soon will be a fix to make sure this only works with AutoIt files)Thought it was just me not be able to get that to work Glad you figured it out... works neat.... EDIT: can also be added to the Autoit3.LUA script that comes with the standard install ... then it works only on the AutoIt3 files !!! Edited July 6, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 6, 2004 Developers Share Posted July 6, 2004 @Valik, when you add this to the AU3.Properties:# Standard Autoit3 LUA Functionsextension.*.au3=$(SciteDefaultHome)\AutoIt3.luaAnd add your function to AutoIt3.lua it will only work on AU3 files.I will add it to the AutoIt3.lua supplied with the Scite4Autoit3 installset.. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valik Posted July 6, 2004 Share Posted July 6, 2004 @Valik, when you add this to the AU3.Properties:# Standard Autoit3 LUA Functionsextension.*.au3=$(SciteDefaultHome)\AutoIt3.luaAnd add your function to AutoIt3.lua it will only work on AU3 files.I will add it to the AutoIt3.lua supplied with the Scite4Autoit3 installset..I've ammended my original post. I added a line to check the lexer and if it's AutoIt's, then it does it's thing. It was easier than I thought. I'm mostly making this post just to make sure you and anybody else who grabbed the first version is aware that I hard-coded a check in.Obviously, the auto-complete thing sort of annoyed me, too, or I wouldn't of spent this much time on it. At least I did learn a little more about Lua, though... Link to comment Share on other sites More sharing options...
Developers Jos Posted July 6, 2004 Developers Share Posted July 6, 2004 For those of you who have the used the standard Scite4Autoit3 installset:Here a new http://www.autoitscript.com/fileman/users/jdeb/autoit3.lua .. download it and replace the current version in the Scite program directory and Autocomplete will be disabled in Comment lines/Blocks...thanks Valik... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 7, 2004 Developers Share Posted July 7, 2004 Think we should also stop autocomplete inside a String .. Agree ?? function OnChar(a) ls = editor.StyleAt[editor.CurrentPos] if ls == SCE_AU3_COMMENTBLOCK or ls == SCE_AU3_COMMENT or ls == SCE_AU3_STRING then if editor:AutoCActive() then editor:AutoCCancel() end return true -- The key is here, this says don't process any more. end return false end SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valik Posted July 7, 2004 Share Posted July 7, 2004 I knew there was some other place I wanted to suppress autocomplete, I just couldn't think of it. In strings was probably it. Link to comment Share on other sites More sharing options...
Nutster Posted July 7, 2004 Author Share Posted July 7, 2004 (edited) That is exactly what I wanted. Thank you. Edit: Just tested it but it did not seem to work. Copy it into the SciTE folder (C:\Program Files\SciTE) and it replaces the one that is already there and then check. I still get the AutoComplete box. Do I have to reboot my Windows 98 machine to get SciTE to read the new LUA file? Edited July 7, 2004 by Nutster David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
Developers Jos Posted July 7, 2004 Developers Share Posted July 7, 2004 (edited) Just stop and start Scite should do.... EDIT: When you are running the Scite4autoit3 it should be installed in C:\Program Files\AutoIt3\SciTE Edited July 7, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
emmanuel Posted July 7, 2004 Share Posted July 7, 2004 so, is the http://www.autoitscript.com/fileman/users/jdeb/autoit3.lua supposed to block autocomplete in strings? that doesn't seem to work for me. Even making sure it has this code didn't do it.function OnChar(a) ls = editor.StyleAt[editor.CurrentPos] if ls == SCE_AU3_COMMENTBLOCK or ls == SCE_AU3_COMMENT or ls == SCE_AU3_STRING then if editor:AutoCActive() then editor:AutoCCancel() end return true -- The key is here, this says don't process any more. end return false endI just typed $banana = "win and got the autocomplete. "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Valik Posted July 7, 2004 Share Posted July 7, 2004 First things first, modify the Lua function to print to the output pane as follows: function OnChar(a) _ALERT("Inside OnChar()") ls = editor.StyleAt[editor.CurrentPos] <rest of the function> Save it, restart SciTE, then try again. If you are seeing "Inside OnChar()" in the output pane each time you type a character, then something else is screwed up. But if you are not seeing that, then something is misconfigured. Link to comment Share on other sites More sharing options...
emmanuel Posted July 7, 2004 Share Posted July 7, 2004 (edited) yeah, there is a Inside OnChar() message for each character typed (in quotes or out of them).When it's $banana = "win" it doesn't autocomplete, it's when there's no closing quote that it still autocompletes... Edited July 7, 2004 by emmanuel "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now