as mentioned quiet similar in the header, may someone tell me, how can I create an own custom-relative-unit-path for the lazarus IDE (version: 2.0.6) .
The IDE has alreaday some internal $(RelativePaths) but I would like to create my own ones and setting them up in the "other unit paths" and finally use them of course ^^
i wanna do somewhere like: "$(MyCustomPath) = C:\Lazarus(someotherpathhere..)"
and put $(MyCustompath) in the "other unit" line and have it work ^^
Below what I would like to see :-)
Best regards
Shpendicus
enter image description here
I think the way to do this may be to use Lazarus IDE macros.
See https://wiki.freepascal.org/IDE_Macros_in_paths_and_filenames for full documentation.
In the section IDE Macros it says
IDE macros: they can be used in almost all IDE fields, e.g. search paths, custom options, file names, run parameters. They are replaced with their value before calling external tools like the compiler or the debugger. They are case insensitive.
and the IDE macro format section includes a few examples of ones which are already defined.
Creating macros is explained here: https://wiki.freepascal.org/Macros_and_Conditionals
To set a macro up for the current project, do the following:
Go to Project | Project Options | Compiler Options | Additions and Overrides
On the righthand side, click Add and select IDE Macro from the drop-down menu
This will open an IDE Macro line in the editor below. In it, replace
MacroName by MyCustomPath and Value by whatever you like. I used D:\Lazarus2\MA
Close the Project Options pop-up
Next, in the directory that MyCustomPath points to, create a unit e.g. Test.Pas that includes a compile stopper like an ! I used
unit Test
interface
!
implementation
end.
Add Test.Pas to the project's Uses list and attempt to compile. The compiler should complain that it can't find Test.Pas.
Next, open Project | Project Options | Compiler Options | Paths and in the Other unit files box at the top insert $(MyCustomPath)
Close Project Options and compile - now the compilation should proceed until it encounters the compile-stopping ! in Test.Pas
Related
I'm using PhpStorm over 3 months and it's a good IDE. I do not know what I've clicked yesterday but since yesterday I have issue with code completion in CSS mainly.
On the screen I have VS Code and PhpStorm and also I've opened the same project.
In VS Code it works perfectly. In PhpStorm it doesn't. I tried some Google First Aid like clear cache, update the IDE, turn On/Off Safe mode etc. but nothing changed.
My Code Completion settings:
Based on your PhpStorm editor area screenshot (many thanks for that BTW: not many people do post it even if asked), all your CSS files are treated as a Plain Text. It's rather unlikely to be a glitch, more like accidental settings change.
Settings/Preferences | Plugins -- make sure that CSS plugin is enabled. If not -- enable and restart the IDE.
If still the same: Settings/Preferences | Editor | File Types -- locate "Cascading style sheet" entry and make sure that it has *.css pattern there.
If not there -- it's possible that you have somehow reassigned it to "Text" file type. If it's there -- just add *.css to Cascading style sheet patterns (it will remove it from Text when doing that).
If still nothing: you would need to provide more/new screenshots.
Does anyone know a way to search for all (and only) the commented code across all classes in a java project?
For example, using "Find in Path" to search for "//" is not what I want because it also returns URIs (http://......). I want a specialized way to do that.
Thanks in advance.
You can use Structural Search in IntelliJ IDEA.
Below screens as for the version 2019.1.1 (Ultimate Edition) (Works for IntelliJ IDEA 2020.3 too)
Go to Edit > Find > Search Structurally...
File type should be Java and select any path wherever you like to search.
From the top right corner click on gear icon and click on Existing Templates...
Then from Java > Comments, Javadoc and Metadata select comments
Then it will add /* $CommentContent$ */ to the Structural Search window as for the first screenshot.
This will find all the commented code (including Javadoc) from the selected path.
For more info refer : Structural search and replace
About the best you could do would be the Find In Path and use a REGEX of:
^//
That will fix your http:// problem. But it won't find comments that don't start at the beginning of a line. I suppose you could write a much more complex REGEX to find "//" but not proceeded by http: But of course comments can be in /* */ blocks too. So it all depends on how absolute you want to get.
As of intellij 2020.3, there is an inspection for commented out code in java:
Java | Code maturity | Commented out code
So if you want a list of commented out code, you can:
right+click your project, module, subfolder, directory or file where you want to search.
click analyze > inspect code
Click OK
This should open the inspection result window where all your commented out code will be grouped under Java | Code maturity | Commented out code :
If you don't want intellij to search for other issues too, you can create a new profile in File | Settings | Editor | Inspections exactly for that and select it in the analyze dialog.
I've used AppCode (Intellij C++/ObjC IDE that replaces Xcode) for a while and really gotten used to being able to Ctrl+Click on any identifier to get to its definition/decleration.
Now on a new work place, I'm using CLion for a somewhat larger code base and Ctrl+Click hardly ever works. It only seem to work when the identifier is in the same file.
Is there anything I need to setup for this to work correctly? CLion seem to index the code successfully and doing text searches works fine.
You need to use import project functionality of CLion from File -> Import Project and give ok for CMakeLists.txt file automatic creation. Never mind the file is for CMake, you can build your project with other tools too, but CLion uses it for the dependencies.
Then append in the beginning of that file a line stating:
include_directories(.)
After that go to File -> Settings and there search for Keymap from the left and after that on right, right below the word "keymap" there is a selection element for taking for example Eclipse default keymapping in use and there you have at least (I tested only it) the ctrl + click functionality working like charm!!
kudos about the include_directories(.) goes to this question: CLion indexer does not resolve some includes in the project directory
You need to press ctrl + alt + shift + n.
And after pressing it a dialog box will appear to enter your variable/function name and click enter.
Tip: Filter the result for a better experience. Filter option is present on right side of the dialog box.
To get a quick peek of function/variable definition press ctrl + q while focusing on the variable or function.
To get the detailed or full definition of function press ctrl + shift + i while focusing on the variable or function.
I just looked at one of my more complicated teaching examples with multiple header/source files where this would come up.
What I see is that ctl-click (and the red/green arrows in the gutter) does work only in the same file. But I can right-click on a method from another file and choose to go to either the declaration (in header) or definition (in cpp).
The hotkeys to do this are not ctl-click. But you can remap hotkeys in IntelliJ ides, so you may be able to come up with hotkey combinations that don't seem too awkward to you.
What helped me was to run File > New CMake Project from Sources
Until that point, Ctrl+click in CLion would go to the definitions, but wouldn't find any usages.
CLion 2016.2 helpfully detects potential errors in the file you're editing, which can be seen in the validation bar to the right of the code.
That's just a single file though, is there a way (like a tool window) to get a list of all such warnings in the whole project, or specific parts of it?
Bonus points if it also lists warnings and errors from the compiler, though that's less important, because the compiler output already includes any it found.
Yes, it is possible. The feature you are looking for is called the Inspector.
Do: Find Action... | Inspect Code. It will show a pop-up that will allow you to select the scope: file, whole project, custom, and the Inspection profile (you can choose the type of errors you want to see):
After clicking OK, this is an example of the output, that you can navigate with the mouse or with keyboard shortcuts:
In version 2017.2, I have it under Code | Inspect Code....
You can also right click a folder in Project view and select Inspect Code... there to be able to check only that folder.
I am trying to exclude a particular file in my project from being compiled.
According to the Intellij IDEA documentation you do this by "marking the file as plain text".
However, the context menu in the project view where this functionality is supposedly located has no such action. I am using version 13.02 of Intellij. Here is what my context menu looks like:
Under File > Settings > Build, Execution, Deployment > Compiler > Excludes, add an entry.
Any attempts to run a path specified here will result in a ClassNotFoundException, and a very important class indicator as well.
Just to compound on Makoto's answer (would comment but don't have reputation), it looks like this feature does not apply to classes (.java) or assets (images)...for these types of files, it looks like you will need to actually go to the compiler and explicitly state that the file(s) should be excluded.
However, for .htm, .xml, or really anything that isn't a class or asset you will find and can use the 'Mark as plain text' option.
Edit: It looks like you can also go to the 'Messages Make' error / warnings view and Exclude from there, a little less work IMHO.
The answer that #Makoto has given is pretty much the way to go, but in case that you are like me and you get easily both distracted and frustrated looking for that menu, you could use this shortcut:
press ctrl + shift + a , and in the input box that appears type excludes, and select the first item that appears.