IDE - Advanced Searching

Hello,

i would like to replace all Date Objects in a hughe Project with DateTime Objects. Tried to search for “% type:date” and other variations but were unable to find anything.

Does anybody know how i could search for just and all API1 Date Objects in my Project, so that i can focus on replacing them?

Thank you.

No… but such a thing would help:
feedback://showreport?report_id=56856 IDE: Make Output of ‘Analyze Project’ useful to get an overview and allow to drill down

Meanwhile…
Here’s a quick and dirty xojo app.
How to use:

  • Analyze your project
  • Select all output in Deprecated and Deprecated-with-Replacement
  • Expand the two sections. Select the first item. Scroll all the way down. Hold “Shift” and click on the last one - to have them all selected. Then Right-Click on one of the selected items, and you get to “copy (to Clipboard)” them.
  • Note: WIth a lot of entries, the IDE will then be a “blocked” and showing a spinning wheel… :wink: Until it’s in the Clipboard.
  • Paste that “copied analyze output” (see steps above) in a .txt file
  • Fire up the quick and dirty xojo app, drag the .txt into the app-window
  • and you’ll get a nicely grouped list of “individual issue types”

I for one just wanted to know which “deprecation/issue types” are in our projects - not > 10’000 entries in a list, but a list of about 300 different “types”). It’s really quick and dirty and could be improved to make the output much more useful. But that should be the job of the IDE…

Anyway - maybe this helps. You should find all instances for the deprecated ‘Date’ in a sorted way… But I know - it doesn’t quite help you to get to the correct place in CodeEditor. So that’s why I’ve added the mentioned feedback://showreport?report_id=56856. If you like to support that, then please add some points to this request. So Xojo knows we need it :wink:

Thank you Jürg.

I’ve added it to my Top Cases! :slight_smile:

Having said the above… if there really is no way to “find all occurences of an Object Type X”, then your best chance is to search the project in two search-steps for:

  • As Date
  • As New Date

This should find Variable Declarations, as well as Method return values/types, and even (Window/Module)-Properties.
Edit: Ah, this certainly should work in one step to search using RegEx Search… :wink:

Let’s hope it gets into the Top 20 soon :slight_smile:
API 2 is here, but now we need ways to get to it in more productive ways than what the IDE currently offers.

Just imagine… You could click on the Group “Label.Text -> Label.Value”, and the IDE offers a refactoring tool for “safe replacements”. And maybe even for “not safe replacements” such as: “Do you really want to replace all Date -> DateTime, even if this might break behavior of your code)?”

And RegEx Search also would allow to find the places where you’ve accidentally a double space between As Date.

I’m not quite fluent with RegEx… so it would be nice if someone could post an example that searches: As*(New)*Date :wink:

"(?mi-Us)As\\s+New\\s+Date|Date"

Really a whole word search in the IDE on “Date” should do it, but you can ignore comments and strings like this:

"[^"]*"(*SKIP)(*FAIL)|(//|'|\\bREM\\b).*(*SKIP)(*FAIL)|\\bDate\\b

But this should only be the first pass if you use Introspection and check an object’s class via a string property. Also, keep “IsA” in mind, as in “if x IsA Date then”.

I’m sure I’m forgetting somewhere else you’d have to check…

I feared a bit that you would chime in here Kem. Because you always nail it :wink:
But i always love to see your solutions and already learned a lot from you. Thank you. :slight_smile:

[quote=459979:@Sascha S]Hello,

i would like to replace all Date Objects in a hughe Project with DateTime Objects. Tried to search for “% type:date” and other variations but were unable to find anything.

Does anybody know how i could search for just and all API1 Date Objects in my Project, so that i can focus on replacing them?

Thank you.[/quote]

the filter at the top of the navigator doesnt search IN code
its for searching the project items (windows, method names, property names, classes etc)

[quote=460039:@Norman Palardy]the filter at the top of the navigator doesnt search IN code
its for searching the project items (windows, method names, property names, classes etc)[/quote]

Ah! Ok. Too bad. I tried the search Pane at the bottom too, but none of both were capable of doing it like i needed it. Until there’s a solution within the IDE, @Jürg Otter workaround will do it. :slight_smile:

Thanks for mentioning this… I haven’t even been aware of that search-option.
So thanks for pointing me to some IDE feature I’ve never used before (or not frequently enough to remember it)… :slight_smile:

Try @Kem Tekinay 's RegEx in the “bottom search pane”. There is a “gear icon” with “drop down button” (left of the “replace field”). Select ‘Use Regex’ there - and search with Kem’s suggestion.

In a test project:

  • Search Option ‘Whole word’, search-string “Date”: finds 163 occurences
  • Search Option ‘Use RegEx’, search-string: see in Kem’s reply: finds 153 occurences (better, as it strips out most/all of the unwanted that get included in whole word search)

But still… I’d love to see this organized and presented in a way more useful way by the IDE with ‘Analyze Project’. :wink:

I am very familliar with it. Thank you :slight_smile:

Xojo Inc. really needs to do more to make the shift to API2 easier. If i would not have offered to my Boss to port the Code in my sparetime to API2, we would have stoped buying Xojo after 2019 R1. :confused:

[quote=459985:@Jürg Otter]Meanwhile…
Here’s a quick and dirty xojo app .[/quote]

This is GREAT! It was perfect for finding the top 10 things I need to transition ASAP.

Thank you!!!