VS Code changing language mode automatically - editor

I am having a weird issue with VS Code. Whenever I try to open a .env file after 1 or 2 seconds it's automatically changed the language mode .env to Shell Script. As a result, syntax highlighting fades away.
If I change the language mode manually from the bottom right corner its works temporarily. If I close the file and open it again language mode automatically changed to Shell Script.
This happens only for the .env file type. I also checked the setting.json but there is nothing related to this issue.
OS: Windows 10
VS Code: 1.60.0
Update: This only happens for a particular .env file.

You can either disable automatic language detection entirely with this setting:
Workbench > Editor: Language Detection
or disable it for a specific language with this setting in your settings.json:
"[env]": {
"workbench.editor.languageDetection": false
}
Use env there or whatever the correct language identifier is for those file types.

Related

Unable to locate sdkmanager.bat. Did you run Android Studio and install cmdline-tools after installing?

i was trying to make use of unreal engine 4 template for AR but i got this error. This step kinda connect android studio with unreal but i just don't work.
Ran into the same issue and fixed it by editing the SetupAndroid.bat file.
Example of adjusted code
Not sure why it doesnt set the location of the SDKManager after it fails the first one. But manually replacing the first location works.
if you encountered this issue when running "SetupAndroid.bat", the reason might be simple. If you check the "SetupAndroid.bat"(right click, edit. Or turn it into a txt), the default sdkmanager path might be different from the actual location.
You might need to search "sdkmanager" from the Android Studio SDK root folder manually(it suppose to display on the cmd interface), find the actual directory and correct the "SetupAndroid.bat", then try it again.
the same here, i tried to search "sdkmanager" at both of my Drive and couldn't find any.
couldn't find any cmdline-tools drive as well.
Try next:
Go to your AppData\Local\Android\Sdk folder
Search for sdkmanager.bat
Navigate to its location and copy it
Open SetupAndroid.bat with Notepad (or other editor of your choice)
Find the line(s) which contains sdkmanager.bat
Paste the copied location (for example \cmdline-tools\latest\bin\sdkmanager.bat)
Save, exit, and run the edited file
This worked for me.
I spent 2 hours to figure out what's wrong with it.
So, provided earlier solutions should fix it:
Simply just replace incorrect path to correct one or, just DELETE most outer IF block and first line where %SDKMANAGER% var first set to invalid (I suppose, outdated path) value.
This is a part of the source code of SetupAndroid.bat from Epic Games. I've checked version 4.27 and 5.1. These lines are kind of identical in both versions (however version 5.1 still has the same exact error, but it works due to changing the order of which path is tried first):
set SDKMANAGER=%STUDIO_SDK_PATH%\tools\bin\sdkmanager.bat
IF EXIST "%SDKMANAGER%" (
echo Using sdkmanager: %SDKMANAGER%
) ELSE (
set SDKMANAGER=%STUDIO_SDK_PATH%\cmdline-tools\latest\bin\sdkmanager.bat
IF EXIST "%SDKMANAGER%" (
echo Using sdkmanager: %SDKMANAGER%
) ELSE (
echo Unable to locate sdkmanager.bat. Did you run Android Studio and install cmdline-tools after installing?
pause
exit /b 1
)
)
And this specific part does not work! I don't know why those who developed that did not check it or they simply don't know how batch file variables work.
The thing here is that on recent Android SDK installations there's no folder tools at the path %STUDIO_SDK_PATH%. So the first condition check fails and then they try to overwrite variable value to correct one with path %STUDIO_SDK_PATH%\cmdline-tools\latest\bin. But this overwrite DOES NOT WORK. You can't just do that in a batch file (which is kind of stupid, but it is). More on that issue with batch vars here: How to overwrite an existing variable using another variable in batch files?
"Good" job! Epic Games

How can I preprocess Storyboard/XIB files with Xcode

I need to preprocess my launch storyboard file to change its background color based on same build time configuration. I've added the following rule under Xcode Build Rules:
But I'm having some problems getting this to work. Actual script is fine.
First, the rule is not being executed. I guess if fails to match the file name. When I specify to match *.storyboard, it gets executed, but I do not want it matching all storyboard files, just that one. Of course, I could check the file name in the script itself.
Secondly, when it gets executed, it does not cause any side effects. I guess that the rules that follow, more specifically Storyboard compiler, fail to pick this file up. It might be that I'm using wrong file paths, or that my change is being overwritten with original file sometime later in the build process. Does anyone have more experience in this?

Where is the Deployement Screen

I am trying to keep my application in the background on the iOS platform using firemonkey.
I have came across an answer witch tells me how to make the application remain in background.
Here is the answer:
You'll need to copy the info.plist file and modify it using a unix EOL
friendly editor (such as Notepad++). Add the following lines to it:
UIBackgroundModes voip
In the Deployment screen for your project, uncheck the original
.info.plist, and add the copy you modified. Note that if you
change any project options that changes the original, you'll need to
go thru this process again, or just reflect the changes in the
modified file.
How ever I can't figure out where is the Deployment screen. Does anybody know ?
(NOTE: I don't do iOS development, so this info is based on some quick experimentation with a new iOS FMX project in XE5.)
Those instructions are for XCode, which isn't Delphi. Delphi doesn't have the XCode deployment screen.
The Delphi equivalent is in Project->Deployment from the IDE main menu. You can locate the .plist file in the Local Name column, in the form YourProject.info.plist. I think the original copy is actually generated when you build your project for deployment (either Release or Debug) to the simulator or device, so you may have to do that first in order to find it.
If you look at the samples for XE5 (which seems to be the one in Samples\Delphi\DataSnap\connectors\iOSClients\client_company_tweet), you can see where they're located once the file has been generated.

Is there any way to get the dart editor to always run the same command?

I always wanted Cmd-r to "Run my main.html" file.
Is there any way to do this. Currently, when I look at the Eclipse XML output of my keybindings, it appears that Cmd-r is bound to "Run". This is fine in general, but it is annoying because I have to always switch out of any .html file I am currently editing and open main.html before I press Cmd-r.
I am on Dart Editor version 0.4.5_r21094.
We are in the process of adding an menu option "Always run the last launch". With this option checked, once you have run the main.html, the editor will run the same launch on Cmd-r (selection no longer matters) until you explicitly launch another html file.
Feature has been added!
Run > Always Run Last Launch menu option when enabled will always run
the last launch unless user chooses another launch explicitly.

Is there a way to sync Xcode preferences and keyboard shortcuts across computers?

I'd like to avoid having to do tweaking the keyboard bindings repeatedly for each machine I use Xcode on.
Sort of like copy the settings file to a particular location in the target computer's filesystem; doesn't need Dropbox.
Yes, at least for key bindings. I'm assuming you're using Xcode4. If that's the case, your Key Bindings are stored here...
~/Library/Developer/Xcode/UserData/KeyBindings
Just copy the 'sets' you want from one machine to the other and there you go.
Note that unlike Xcode3, Xcode4 now respects global bindings as well. Global bindings are stored here...
~/Library/KeyBindings/DefaultKeyBindings.dict
Global bindings are for instance, if like me, you prefer the way cursor movement is handled in Windows (e.g. Home/End work on the line, CTRL Left/Right jump a word at a time, etc.) you can remap the keys for the overall system, and Xcode4 respects that. In Xcode3, such changes had to be duplicated in its own key bindings file.
Also note that if the same key is defined in both the defaults and the Xcode4 file, the latter 'wins'.
Additionally, you can unmap a system-wide key when using Xcode. This will disable that key when using Xcode, but leave it enabled elsewhere.
(If you open the actual key bindings file in say TextEdit or a PList editor (that's all these files are) then you'll see it still defines the command, but leaves the key itself cleared out.
Something else that may be of interest is KeyBindingsEditor. It's a great editor for creating system-wide shortcuts. While it claims to support Xcode, it doesn't (or rather Xcode 3 and 4 it doesn't. I can't speak to earlier.)
However since again Xcode 4 can utilize system-wide shortcuts now, you can use this indirectly with Xcode. I personally am very happy about that as now, no matter where I am, including Xcode, my keyboard shortcuts are unified across the entire system.
HTH, Mark
Adding to Mark's answer, setup dropbox to point that file to ~/nameofyourchoice on all of your machines, and viola, everything should be synced. You'll need to test it out to see if other machines don't overwrite etc.

Resources