Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tip resources from VBA code comments and other features suggestions. #137

Open
loquat opened this issue May 16, 2024 · 2 comments
Open

Comments

@loquat
Copy link

loquat commented May 16, 2024

it seems Intellisense tip have 3 types of resources

  1. external xml file with $workbook.name$..IntelliSense.xml
  2. built-in xml part inside workbook using Workbook.CustomXMLParts.Add strXMLContent
  3. worksheet with a name of "IntelliSense"
    i have found two problems
  4. when tip resources updated then tips will not auto-update
    maybe we can add a callback function to update tip resources by hand.
  5. when the external and built-in xml resource does not exist, the worksheet("Intellisense") resource seems not load
    which seems like a bug
    and i have suggestions like below
  6. maybe we can add a new resource, which read from VBA IDE.VBE code comments
    '@FuncDesc:A function described by vba comments
    '@param1:FirstArg As Variant
    '@desc1:this is for FirstArg
    ' and this for FirstArg too
    '@Param2:SndArg As Long
    '@DeSC2:this is for SndArg
    Function MyVbaFunction(FirstArg, SndArg)
    MyVbaFunction = FirstArg + SndArg
    End Function
  7. when four types of tip resources all on
    i think the tip load priority can be like this: vba comments -> worksheet -> external xml -> built in xml
    because vba comments and worksheet data can be set and update more conveniently.
  8. maybe we can add a callback function to set custom tip data like this.
    Sub GetTipString(byref strTipContent as string)
    strTipContent = ReadTextFile("c:\1.xml")
    End Sub
@loquat loquat changed the title New features suggestion Add tip resources from VBA code comments and other features suggestions. May 17, 2024
@govert
Copy link
Member

govert commented May 22, 2024

Hi @loquat - thank you for the great feedback.

There is a way to refresh the IntelliSense server, though it's only easy to call from C# as IntelliSenseServer.Refresh(). From VBA one would have to get the active IntelliSense server Id from the environment variable EXCELDNA_INTELLISENSE_ACTIVE_SERVER, then call a magic hidden function called IntelliSenseServerControl_{activeServerId} with the argument "REFRESH". I'll try to make a VBA sample when I get a chance.
This would rescan all the IntelliSense sources for descriptions etc.

Your point 5 indeed sounds like a bug - I'll have to check.

Scanning the VBA for such pseudo-attributes is an interesting suggestion.

What do you see as the advantage of option 8 beyond writing the external file like 1 and having a refresh option?

@loquat
Copy link
Author

loquat commented May 27, 2024

I'll try to make a VBA sample when I get a chance. This would rescan all the IntelliSense sources for descriptions etc.

----thanks in advance, i will try myself too.

Scanning the VBA for such pseudo-attributes is an interesting suggestion.

----i know some people would use this kind of comments to auto generate help files like chm.
----so this idea should take visual studio ide features as reference.

What do you see as the advantage of option 8 beyond writing the external file like 1 and having a refresh option?

----that is my idea for vba developers to update or add tip resources at runtime as their wish.
such as:
IntelliSenseServerControl_{activeServerId} "StartServer"
IntelliSenseServerControl_{activeServerId} "ReStartServer"
IntelliSenseServerControl_{activeServerId} "StopServer"
IntelliSenseServerControl_{activeServerId} "UpdateResources", enuAll 'update tip resources follow option 7 loading priority.
update externalxml or worksheet tip or both, it will edit/replace tip resource items, no deleting the old ones.
IntelliSenseServerControl_{activeServerId} "AddCustomResource", enuXML, "c:\1.xml"
IntelliSenseServerControl_{activeServerId} "AddCustomResource", enuJSON, "c:\1.json"
IntelliSenseServerControl_{activeServerId} "AddCustomResource", enuString, strTips 'one can add func tips once a time.
when i say AddCustomResource, it means edit/replace tip resouce items, no deleting the old ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants