Extention OmniPascal (vscode) using too much CPU - How to resolve? - visual-studio-code

Every time I start vscode, OminiPascalServer.exe start to use 35 to 50% of CPU process.
This appears not only in my computer, but with every person I know who use this extention.
Exist some configuration to fix it?
Thanks!

This usually happens at the start as OmniPascal probably need to scan through the entire workspace. So one way to quicken the process is to reduce the amount of things it need to scan.
This is how I do it and I notices a drastic improvement:
Create a new VSCode workspace that only focuses on Pascal files
In your VSCode workspace, add relevant folders
In Settings > Files > Exclude, exclude all irrelevant items in your Pascal project. (I don't know if this actually matters, but it seems to help)
In the case that you want to add external library, rather than adding them as part of your workspace, you can add them in Settings > OmniPascal > Search Path. You might also need to change the Symbol Index to select "searchPath"

Related

Codesys ScriptEngine tool/key binding

I have created some scripts in (Iron)Python that help me with the generation of a lot of the boilercode in my project. However, every thime I change something in some part of my project, I have to rerun those scripts. Right now, every thime I have to go to the menu -> Tools -> Scripting -> Execute script File... and navigate to the script in the File Explorer.
However, I go into Tools -> Customize... I can see that there are listings for Script0, Script1 and etc. They are also available in the keyboard shorcut bindings. This suggests to me that there must be a way toadd ToolMenu entries and key shortcuts to run predefined scripts, however all of them have "(unavailable)" written next to them, and I can't figure any way to configure them and make them do something.
Does anybody know how to make use of them?
Follow this instruction:
https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_executing_scripts_toolbar.html
Note:
What you see in "Add commands" under "Scripting Commands" is a alphabetic index list of your script file names. That means if no scripts are active linked in config.json then the count of maximal possible 32 scripts are listed under alphabetic index "S" as "Script0(unavailable)" to "Script31(unavailable)". If linked one script in config.json then is listed under alphabetic index and "Script0(unavailable)" is hidden.

VS Code alternative to webstorm's "find usages"

In WebStorm there's a really nice feature that you can right-click a file and choose "Find usages...", what would output all the files and all the line numbers in the project where that file is referenced (e.g. where path to it is specified as a string in JS require).
I really love that feature, since it's very useful for refactoring - before I delete or edit smth I might want to find usages first to get clear understanding of what other things would be affected.
Is there a way I could do the same thing with VS Code?
Are there alternatives to Webstorm's "Safe delete" (when deleting a file it looks for usages first and shows a warning if there're some) and rename - so if I rename e.g. foo.js to bar.js all references to it in the project (e.g. paths within require) would be automatically updated?
Unfortunately there are no built in ways to do this in VS Code and I don't know of any extensions to do this, either.
Actually you can open the helper console ( Cmd + Shift + P in mac and the shortcut is Shift + F12) and go to find all usages

Eclipse CVS compare: difference not disappearing after copying

In Eclipse, CVS text comparing works poorly against large numbers of difference between the local and the remote version. It's very desirable to update the the status of comparison every once in a while by a simple command. Basically it's reloading the local file, do the comparison again, to see where we have reached, and try not to make mistakes.
Unfortunately, "Team" - "Synchronize" again after editing every several lines is not convenient, neither does it solve our problem. As I have observed, when there are many differences, Eclipse can mark the already identical lines as different to the remote ones, if we use this approach to compare again.
How can we solve it in Eclipse?
At last I found a simple enough solution, but can be ignored easily: use the "Java structure compare" panel.
When doing the CVS comparison, above the two horizontal text area, we can see the "Java structure compare" panel.
The icon "+", "-" and arrows can show structurally how the two files are different.
Double-click on a method to edit. After several lines of work, double-click the method again to update the status of comparison. If the local version is identical to the remote one, all the color squares will dissappear from the vertical scroll bar on the right, clearly marking where we have reached. Also, after doing this, you jump to the next difference in this method, to start working again.
Re-"Synchronize" will mess the whole file up, so don't do it in the middle, unless you are at the final stage and have fewer enough differences.
Just a little piece of humble opinion about how to use Eclipse more efficiently. After all it's our daily tool. Better to learn these tricks as soon as possible.

Open cscope results in the same buffer

This might seem to be a very very stupid question.
But for the past few years I have been using vim and cscope on the terminal, with some screen to make life a bit bearable.
I have just started to learn emacs and it is much more satisfying to use it.
Problem using emacs:
Every time I do M-x find-c-symbol, I get a new buffer with a bunch of files, but I don't know how to open the file at the exact line number.
I googled a lot and found this to open file under cursor: M-x ffap
but this opens at the first line. Can some emacs expert help me??
Thanks
I've got both Emacs 23.x and 24.x installed, both setup with working cscope and xcscope installs. Neither has a "find-c-symbol" function, but there is a "cscope-find-this-symbol", which is what I assume you're actually using.
I'm going to assume you're using a GUI version, and not the text-only version, and that you're actually getting the *cscope* buffer automatically being opened and created (since that's what it sounds like from your description).
For a simple search, I'll get results that look like this:
Finding symbol: debug
Database directory: /home/user/emacs_tags/modular/
-------------------------------------------------------------------------------
*** /home/user/code/modular/frontend/common/controller.test/src/MainTest.cpp:
<global>[73] #ifdef debug
-------------------------------------------------------------------------------
Database directory: /home/user/emacs_tags/rrsdk/
-------------------------------------------------------------------------------
*** /home/user/code/rrsdk/fs/apps/busybox/src/shell/ash.c:
<global>[303] #define debug optlist[15 + ENABLE_ASH_BASH_COMPAT]
*** /home/user/code/rrsdk/bootloader/u-boot/src/board/mcc200/auto_update.c:
<global>[53] #undef debug
<global>[55] #define debug(fmt,args...) printf (fmt ,##args)
<global>[57] #define debug(fmt,args...)
-------------------------------------------------------------------------------
Search complete. Search time = 22.44 seconds.
Assuming your results look similar (they should), there are two multiple target areas in the result. Each file line (the lines starting with ***) is a target to the start of that file. Each individual result is also a target area. If you click on one of the lines that lists a specific match (or put your cursor on it and press enter), it will attempt to jump to the specific line matching the result. If it's not jumping to the specific line correctly it usually means your code has changed since the last time the cscope index file was generated.
I'm not sure how you're using the cscope tool, but you can setup xcscope to auto-index on every change to keep the file up to date, but it really only works for smaller code bases where you can keep the cscope.out files in the top level directory and provide it with a full file list for the files to index. Most people I've talked to use the cscope tool by hand in an external script to manually index/re-index every once in a while and then just interface to the existing cscope database(s) using the emacs tools (mine takes about 4 hours to generate the cscope database for a project that includes the Linux kernel as a sub-part).

Where is startup.m supposed to be?

I've been chasing the answer to this question in the MATLAB documentation for a long time...
For example, at the bottom of
http://www.mathworks.com/help/matlab/matlab_env/changing-the-startup-folder.html
it says
Use the startup.m file to specify the startup folder...
...which is plainly absurd, since elsewhere the documentation says that startup.m is to be found in the so-called "startup folder". So therefore there's no way for this file to specify where this folder should be.
Etc., etc., etc. This sort of circularity pervades everything I've found in the docs on startup.m.
What I want to know is: can I or can't I customize the location of the "startup folder" in a way that is persistent, and if so, where is this persistent information stored?
The best method, I find, is this. Let's say you want MATLAB to start up in mystartupdir, and you've placed startup.m in that directory.
On Windows, make a shortcut icon to MATLAB, then right-click on it and select Properties. Edit the field Start In. Now, use this icon whenever you want to start MATLAB.
On other platforms, you can run MATLAB with the -sd flag to specify the startup directory:
matlab -sd mystartupdir
If you don't specify a startup directory, MATLAB will use the default specified by the userpath command. You can place your startup.m file there.
According to this page in the docs, you should create your own startup.m in the "startup directory" which, if you follow the link, leads to this page explaining the definition of "startup directory" in this context.
You can retrieve this "startup directory" with the userpath function which returns, on my system:
>> userpath
ans =
C:\Users\MYUSERNAME\Documents\MATLAB;
Personally, I just set the "Start In" in the shortcut to whatever I want - but obviously this won't work if you're not on Windows; if you're not on Windows or prefer not to rely on the shortcut you should create a startup.m with a call to cd in whatever directory userpath returns.
The docs also say you can modify the userpath function, if you so desire, or the matlabrc.m file in matlabroot/toolbox/local (but you can only do the latter if you're a MathWorks engineer or a system administrator, otherwise MathWorks will rain fiery hell down on you from above, or something...).
On Mac OS X, you may put your startup.m file in /matlabrootfolder/toolbox/local/. For example, this path might look like the following for Matlab 2012: /Applications/MATLAB_R2012a.app/toolbox/local/.
To prevent the file from being removed after upgrading Matlab, you may use a symlink to the file. If your startup file is stored at $HOME/myDir/startup.m, for example (in Bash):
cd /Applications/MATLAB_R2012a.app/toolbox/local/
ln -s ~/myDir/startup.m .
Reference: http://www.mathworks.com/help/matlab/matlab_env/startup-options.html
This is meant as a pointer for Lx users (as confused as I was at first...). I work on Debian based boxes, but the same should apply to the CentOS system lineup, etc.
Check that after install you do have the directory/ies: ~/.matlab/<yr_release(s)>
Note that you may have several releases there as is my case. matlab actually permits that.
Create ~/.matlab/startup.m Incidentally I also created my directory Workspace there. That's completely optional
In your Matlab window's Home tab find the menu iten/icon Set Path, click on it and add a "matlab search path" with the button Add folder top left. Add ~/.matlab as a new search path. Change should take effect immediately.
Restart Matlab to check that the content of ~/.matlab/startup.m is correctly taken into account at launch time.
I hate GUIs... I thought you might want to know ;-) HTH.
As read in http://fr.mathworks.com/help/matlab/matlab_env/matlab-startup-folder.html#buj_13n :
Changing the Startup Folder
Starting in R2014b, you can change the startup folder using the
General Preferences panel. On the Home tab, in the Environment
section, click Preferences. Select MATLAB > General. Choose an option
for the Initial working folder.
By default, the initial working folder is set to Location based on
MATLAB startup rules.
I wish it did not involve the graphical desktop interface, though. By looking closely in the file matlab.setting, which under Linux should lie in ~/.matlab/<your_release>/, you can find the lines
<key name="UserPath">
<string>
<value><![CDATA[<some_directory>]]></value>
</string>
</key>
where you can certainly specify manually the startup directory.
For me (I'm using Linux) it worked to put the "startup.m" to the home directory. Apparently, the home directory is by default on the matlab path. Strangely, it also worked when I put the "startup.m" into a newly created "matlab" (must be all lower-case) folder in the home directory. Let me know whether it also works on your system.