Help with formatting module & some feature suggestions

Started by fbfans, July 04, 2026, 01:45:03 AM

Previous topic - Next topic

Paul Squires

@hajubu

I have fixed the TODO parsing. Use the files "modParser.inc", and "modParser.bi" in the development branch:  https://github.com/PaulSquires/tiko/tree/development/src

I tested the new code with the following test variations:
'TODO: This is sample text for "I need to do" in the last line 6
'ToDo: (upper and lowercase)
'    todo: (leading spaces)

/'
'     ToDo: (in multiline comment, upper/lower, leading spaces)
'/
Paul Squires
PlanetSquires Software

hajubu


fbfans

Hello Paul,

I've been testing my formatting module again, and unfortunately it still breaks the auto-indentation. I've attached my code — could you please take a look at it when you have a moment? Thank you.

I noticed that you're already preparing the next release and I saw your planned work. I think there's still some room to improve the overall user experience of Tiko, and while you may already be working on some of these, I feel the following issues are quite important:

1.Sidebar refresh problem: When opening or closing files, the sidebar doesn't update synchronously, and there's no manual refresh button either.
2.Function list collapse/expand is not working (I mentioned this in my first post). The Explorer and Bookmarks panels work fine, but the Function list doesn't collapse/expand properly. This makes it less intuitive when many files are open.

3.Bookmarks show garbled text for Chinese characters, and only work correctly when the file encoding is ANSI. You previously fixed the garbled text issue in the TODO list — could you perhaps apply a similar elegant fix here?
4.Suggestion for hover hints on #include lines: For example, on #include once "AfxNova/Dwstring.inc", it would be helpful to show a tooltip like "Dwstring.inc, right-click to open". It took me a long time to discover that Tiko even supports this feature.
5.Localization language selection: Since Tiko already supports several languages, could we have a listbox for selecting the language? It would be much more user-friendly to double-click a file directly.

Thank you for your work on this great editor. I don't mean to put any pressure on you — I just hope that, while you're enjoying coding, you might find some time to address issues like #1 and #2, which would significantly improve the user experience.

Wish you happy coding!

Paul Squires

@fbfans

Thanks for the source file and suggestions. I will look at the formatter and your suggestions as soon as I can. I have a short list of things to fix/implement before I can get to your list.

QuoteSidebar refresh problem: When opening or closing files, the sidebar doesn't update synchronously, and there's no manual refresh button either.
Maybe you can explain this one a bit more. Opening/Closing files should automatically reload the Explorer and Functions panes (maybe the bookmarks list is not being cleared and refreshed?).

What I do need to work on is updating the Functions list in real time as the user types in a Sub/Function  End Sub/End Function combination WITHOUT SAVING. Currently, it is the act of saving the file that triggers a re-parsing of the code thereby updating the Functions list. I plan to switch this to either use continuously scanning background threads, or simply do a re-parse of the code when the ENTER key is pressed.


Paul Squires
PlanetSquires Software

Paul Squires

Quote from: fbfans on July 10, 2026, 05:34:30 AMFunction list collapse/expand is not working (I mentioned this in my first post). The Explorer and Bookmarks panels work fine, but the Function list doesn't collapse/expand properly. This makes it less intuitive when many files are open.

Should be fixed now in "frmFunctions.inc" on the development branch. Just had to slightly change the WM_LBUTTONUP message:

        case WM_LBUTTONUP
            ' determine if we clicked on a function name or a node header
            dim as RECT rc
            dim as long idx = Listbox_ItemFromPoint( hWin, GET_X_LPARAM(_lParam), GET_Y_LPARAM(_lParam))
            ' The return value contains the index of the nearest item in the LOWORD. The HIWORD is zero
            ' if the specified point is in the client area of the list box, or one if it is outside the
            ' client area.
            if hiword(idx) <> 1 then
                dim as clsDocument ptr pDoc = cast(clsDocument ptr, ListBox_GetItemData( hWin, idx ))
                dim as DWSTRING wszCaption = AfxGetListBoxText( hWin, idx )
                if (left(wszCaption, 4) = "true") orelse (left(wszCaption, 5) = "false") then
                    ' Toggle the show/hide of functions under this node
                    if pDoc then pDoc->bFunctionsExpanded = not pDoc->bFunctionsExpanded
                    ' allow listbox click event to fully process before loading new functions
                    PostMessage( hWin, MSG_USER_LOAD_FUNCTIONSFILES, 0, 0 )
                else
                    ' Attempt to show the function name
                    dim as long nLineNum = getFunctionsLinenumber( wszCaption )
                    dim as DWSTRING wszFunctionName = getFunctionsFunctionName( wszCaption )
                    dim as DWSTRING wszDiskFilename
                    if pDoc then wszDiskFilename = pDoc->DiskFilename
                    OpenSelectedDocument( wszDiskFilename, wszFunctionName, nLineNum )
                end if
            end if
Paul Squires
PlanetSquires Software

Paul Squires

Quote from: fbfans on July 10, 2026, 05:34:30 AMBookmarks show garbled text for Chinese characters, and only work correctly when the file encoding is ANSI. You previously fixed the garbled text issue in the TODO list — could you perhaps apply a similar elegant fix here?
This is now fixed in the development branch. "frmBookmarks.inc"

Also, you were correct that the Bookmarks in side panel list were not getting refreshed/updated when "Save" was invoked. This is now fixed.  "frmMainFile.inc"  added "LoadBookmarksFiles()" to the "OnCommand_FileSave()" function.

QuoteSuggestion for hover hints on #include lines: For example, on #include once "AfxNova/Dwstring.inc", it would be helpful to show a tooltip like "Dwstring.inc, right-click to open". It took me a long time to discover that Tiko even supports this feature.
This is harder to implement than it should be (because I had already tried to implement such a feature before :-) )
The problem is that the Scintilla editing control does not expose or fire any type of MouseHover notification message. The hacks that I have read indicate having to subclass each editing window and hook into Scintilla's own message loops. I'm sure that it can be done but I decided against it because it would introduce a layer of complexity that I fear would be brittle and possibly lead to instability.

QuoteLocalization language selection: Since Tiko already supports several languages, could we have a listbox for selecting the language? It would be much more user-friendly to double-click a file directly.
I posit that it is extremely rare that Tiko users switch between localized languages enough to necessitate changing the current UI. Maybe you do with Simplified Chinese and English? But I expect that is the exception rather than the rule.
Paul Squires
PlanetSquires Software