Jump to content

BETA: SciTE v5x & lua Dynamic_include and "Smart" AutoComplete for Vars/UDFs/Abbrevs


Jos
 Share

Recommended Posts

Hi Jos, I was wondering if you would have any objections to making a minor modification to AutoItAutoComplete.lua, line 667 (roughly) (Also not sure if the other locations need it too or not) from this:

-- Show Calltips for functions
            if editor.StyleAt[editor.CurrentPos - 2] == SCE_AU3_FUNCTION
                or (editor.StyleAt[editor.CurrentPos - 2] >= SCE_AU3_UDF and editor.StyleAt[editor.CurrentPos - 2] <= SCE_AU3_FILEUDF) then
                    scite.MenuCommand(IDM_SHOWCALLTIP) -- Show ToolTip for Functions
            end

To This:

-- Show Calltips for functions
            if editor.StyleAt[editor.CurrentPos - 2] == SCE_AU3_FUNCTION
                or (editor.StyleAt[editor.CurrentPos - 2] >= SCE_AU3_UDF and editor.StyleAt[editor.CurrentPos - 2] <= SCE_AU3_FILEUDF) then
                    if editor:CallTipActive() then editor:CallTipCancel() end
                    scite.MenuCommand(IDM_SHOWCALLTIP) -- Show ToolTip for Functions
            end

I have been trying to figure out an annoying problem I was running into, namely the following was occurring, only after calling a function in another function's first param,

1.thumb.png.6ec0a234e083868d4cdf7dfed1be2c94.png

With my modification, it seems to be fixed,

2.png.677b7e001c8a467590580c7acb83652a.png

Thank you.

 

 

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

  • Developers

So you are pressing Ctrl+Shift+Space to activate the Show Calltip manually while typing StringInstr in that example as normally it would show the AutoComplete dropdown and show the proper Calltip op completion?

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

Sorry I see my first post wasn't written clearly.

If I understand what you are asking, both examples I had just finished an auto-complete selection using enter for StringInStr to activate the Call tip. The lower example of course is with my proposed change. The upper one is the original version.

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

  • Developers
41 minutes ago, donnyh13 said:

If I understand what you are asking

What I guess I am saying is that I do not see the issue you report, so try to first figure out what steps to take to get this "wrong" calltip.
The only way I was able to get it to go wrong is to force the calltip of ConsoleWrite before typing the ( after the StringInstr.  

So: Which what do I need to do to see your reported issue? :) 

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

41 minutes ago, Jos said:

what do I need to do to see your reported issue?

Okay, sorry about the misunderstanding.

So how I keep running into the problem is: (to re-use my previous example)

  • I type consolew, press enter to accept the auto complete for that function.
  • Autocomplete inserts ConsoleWrite( and call tip is activated for ConsoleWrite (and remains active)
  • Now I type StringInS and press enter for that AutoComplete
  • AutoComplete Fills in StringInStr( Call tip flashes but remains the same CallTip for ConsoleWrite instead of StringinStr.

In case it makes a difference, for user settings I have:

dynamic.include.always.update.local.file=y

autocomplete.au3.on.enter=   (Blank)

autocomplete.multi=1

proper.case=1

autocomplete.au3.ignorecase=1

autocomplete.au3.min.length=2

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

  • Developers

Strange...   it doesn't go wrong for me when I do the same steps with those same property variable settings. 🤔

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

 

..... Maybe I'll try reinstalling everything...

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

Okay. Clean Install, Works correctly... Ill see what seems to have caused it.

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

Okay. I seem to have missed an update for AutoItAutoComplete somewhere. The file I had was the problem?? Sorry about that.

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

Hi Jos, I see AutoComplete for Includes seems to be missing (and removing) the beginning Quotation mark.

1.png.68fa7330572f045b015ca0500ebe297a.png

2.png.ee8080136a8cd4d9456571cdd03adb58.png

 

Edit, actually it seems to be how it is stored in the Tables?

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

  • Developers
Posted (edited)
9 hours ago, donnyh13 said:

Edit, actually it seems to be how it is stored in the Tables?

Correct, as the start , ' or < is there already is this what is being inserted.....   but I see that < is still working but ' & " is causing issues. 
Will have a look later..

Edited by Jos

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

  • Developers

Could you change line 594 in AutoItAutoComplete.lua to :

editor.WordChars = swordchars .. '-'

and try again?  Not sure anymore why I also added '"> in there as well, but that obviously is the culprit. 

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

2 hours ago, Jos said:

that obviously is the culprit

That fixed it. Thanks Jos!

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

Hi Jos,

I have a largish feature request. I’m not sure if it’s only something I am seeing a need of or not, but thought I would throw it out here and see what you thought. In developing the LibreOffice UDF, I frequently need to use internal Functions that are, of course, in a separate file, and frequently not used already in the present file. Would it be possible to add something like you did for the Dynamic Includes where I could manually include internal functions from a separate file?

Something like: #SciTE4AutoIt3_Dynamic_Include_Internal_Func_Path=;C:\folder\etc.au3

I am mainly looking for it to be included in the AutoComplete, and have CallTips available for it also.

Not sure if there would be much need for that feature or not?

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

  • Developers

Not sure I understand what you are looking for: 
Are you looking for the functionality to copy the function over into the script you are working on or simply for your own standard includes ( which are currently supportedd already in AutoIt3) ?

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

10 minutes ago, Jos said:

Not sure I understand what you are looking for: 

Sorry, I'll try again. 

Right now your Dynamic Include script searches my current script, opens any includes that I have at the top, and records all functions in those files to a table, so that they are both available in the AutoComplete suggestions and have a CallTip when used.

However currently, and understandably, your script skips any functions that are for Internal use only ("__Func"). What I am hoping for was a way to add the internal functions found in a specific file also to the AutoComplete Table etc., so I don't have to switch, in my case, to my Internal functions au3 file, copy the function name and parameter layout, switch back to my current script I am working on, and paste it there so I can use that internal function in another script. i.e.

UDF_Func.au3

#include "Internal_Funcs.au3"

Func _Func_For_User($vSomeParam)



EndFunc

 

Internal_Funcs.au3

#include-once

Func _MyPublic_Func()

EndFunc

Func __MyInternal_Func($vParam)

EndFunc

I am working on the file "UDF_Func.au3", I want to use the function _MyPublic_Func(), I start typing, the AutoComplete pops down and lists that function.

But what if I want to use the function __MyInternal_Func() ? I have to switch to "Internal_Funcs.au3" and copy the name and syntax myself if I've never used it in "UDF_Func.au3" before.

What I want is to be able to specify that I want both public and internal functions in "Internal_Funcs.au3" to be included in the AutoComplete, etc., table(s), and CallTip api file.

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

  • Developers

Ah ok, so you like to use any __* func from any possible include file listed, while the whole idea of using the __* naming for it to be used only in the specific file itself? 🙂 

Why not simply rename it so it will appear? 
 

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

22 minutes ago, Jos said:

Why not simply rename it so it will appear?

I could... but in my case, the internal funcs are internal to the UDF, and not meant for users using the UDF. But the UDF has multiple subdivisions, such as Table, ParStyle, etc that use the same "Internal" functions such as "IntIsBetween". Which the user has no use for.

Edit*

But I do see your point. Perhaps it's my logic that needs improving. Thank you.

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

8 minutes ago, Jos said:

any possible include file listed

Not exactly any include, just a specific one, because otherwise, the AutoComplete list would get over populated.

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

I can see that this would be handy.

@donnyh13 is talking about:
https://github.com/mlipok/Au3LibreOffice/blob/main/LibreOfficeCalc_Internal.au3

I would like to add something like this:

Quote

#SciTE4AutoIt3_Dynamic_Include_AutoComplete_Internal=y      ;dynamic.include.autocomplete.internal=n/y

or even better something like:

Quote

#SciTE4AutoIt3_AutoItAutocomplete_Internal=__LOCalc_*

to all files below:

Quote

LibreOfficeWriter_Table.au3
LibreOfficeWriter_Shapes.au3
LibreOfficeWriter_Par.au3
LibreOfficeWriter_Page.au3
LibreOfficeWriter_Num.au3
LibreOfficeWriter_Internal.au3
LibreOfficeWriter_Images.au3
LibreOfficeWriter_Helper.au3
LibreOfficeWriter_Frame.au3
LibreOfficeWriter_Font.au3
LibreOfficeWriter_FootEndNotes.au3
LibreOfficeWriter_Field.au3
LibreOfficeWriter_Doc.au3
LibreOfficeWriter_DirectFormating.au3
LibreOfficeWriter_Cursor.au3
LibreOfficeWriter_Char.au3
LibreOfficeWriter_Constants.au3
LibreOfficeWriter_Cell.au3
LibreOfficeCalc_Sheet.au3
LibreOfficeCalc_Internal.au3
LibreOfficeCalc_Doc.au3
LibreOfficeCalc_Helper.au3
LibreOfficeCalc_Constants.au3
LibreOfficeCalc_Cell.au3

 

btw.
I had a similar situation a few days ago, luckily in my case it was enough to change the name of the function, because it was actually not "Internal"

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...