Error loading tmLanguage and tmTheme files in Sublime Text 3 - color-scheme

With Sublime Text 2 I was able to style an output panel with
MyOutputView.set_syntax_file("/Path_to/my.tmLanguage")
MyOutputView.settings().set("color_scheme", "/Path_to/my.tmTheme")
in the current beta (3047) of Sublime Text 3 two windows pop up with the following messages (they also get printed to the console):
Error loading syntax file "/Path_to/my.tmLanguage": Unable to open
/Path_to/my.tmLanguage
and:
Error loading colour scheme /Path_to/my.tmTheme: Unable to open
/Path_to/my.tmTheme
Is this a bug that I should report, did the API change, did sublime move away from tm files?

From the ST3 API docs, it seems that most of the paths are relative, either to Packages or Installed Packages, depending on the class/method you're looking at. Since plugins should be designed for portability between 3 different platforms, and between standard and portable installs, relative paths are a good idea. Try setting your code to:
MyOutputView.set_syntax_file("Packages/MyLang/my.tmLanguage")
MyOutputView.settings().set("color_scheme", "Packages/MyColorScheme/my.tmTheme")
and you should be all set.

Related

How do I get the command line Delphi-2007 compiler to ignore or suppress a particular warning

I am using Delphi 2007. I know how to get the IDE compiler to suppress/ignore particular warnings.
But how do I get the command line compiler to do this ?
You use the -W-[WARNING] option. The following example turns off W1036 ("Variable %s might not have been initialized"):
dcc32 test.dpr -W-USE_BEFORE_DEF
The only way I've found to find out the warning name to use is to create a simple console project in the IDE, add code that will produce the warning you want to identify, and then set the Project->Options-Compiler-Hints and Warnings to suppress that warning. Then build your project. Show the Messages window, go to the Output tab, Ctrl+A to Select all, Ctrl+C to copy.
Create a new console app.
program Test1;
{$APPTYPE CONSOLE}
uses
SysUtils;
begin
WriteLn('Test1');
ReadLn;
end.
Use Project->Options->Compiler`->Hints and Warnings, and turn off the warning(s) you want to suppress.
Build your test project.
In the Output tab of the Messages window, select all (Ctrl+A or using the context menu) and copy to the clipboard (Ctrl+C or via the context menu).
In a new Notepad window (or a new editor tab), paste in the contents of the clipboard. You'll find a long block of dcc32.exe command line similar (but probably much longer) than this (I've emphasized the relevant parts to notice):
Build started 02/05/2016 2:48:48 PM.
Project "E:\Code\Project1.dproj" (Make target(s)):
Target CoreCompile:
c:\rad studio\5.0\bin\dcc32.exe -DDEBUG;DEBUG -I"c:\rad studio\5.0\lib";"c:\rad studio\5.0\Imports";"C:\Users\Public\Documents\RAD Studio\5.0\Dcp";E:\Code\FastMM4;E:\madCollection\madBasic\BDS4;E:\madCollection\madDisAsm\BDS4;E:\madCollection\madExcept\BDS4;"E:\Code\Virtual Treeview\Source";E:\code\Indy10_5294\Lib\Core;E:\code\Indy10_5294\Lib\System;E:\code\Indy10_5294\Lib\Protocols;
--SNIPPED ANOTHER DOZEN LINES-- --no-config -W-USE_BEFORE_DEF Project1.dpr
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.12
So as a result of all this, we've identified USE_BEFORE_DEF as the warning name for W1036 for use with the command line compiler, as well as illustrated exactly how to supply it to the compiler.
You can, of course, disable more than one warning in order to identify them; I've just used one for simplicity, and snipped out a lot of the command-line output that is produced.

Sublime Text 2 plugin editorconfig does not work on Mac OSX

I am used to work with an .editorconfig file at the root of my projects and this one works great with phpstorm. But for some reasons I cannot make it work with Sublime Text 2 on Mac OSX mavericks.
Sublime 2.0.2 build 2221
I tried the official editorconfig package installation here https://sublime.wbond.net/packages/EditorConfig with the console and manually but no change after restart of Sublime or even my Mac:
Sublime just use his default settings for all indentations.
Any idea what I should check ? I am stuck.
Here is my .editorconfig file for info:
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
# 4 space indentation
[*.php]
indent_style = space
indent_size = 4
# 2 space indentation
[**.md]
indent_style = space
indent_size = 2
# 2 space indentation
[**.yaml]
indent_style = space
indent_size = 2
# Tab indentation (no size specified)
[**.js]
indent_style = tab
[**.html]
indent_style = tab
[**.less]
indent_style = tab
indent_size = 4
You don't use editor config files. You use sublime settings JSON files. These can be specific to your project, a language, or the whole editor. Go to "Sublime Text" next to the apple symbol (on a Mac, sorry I don't know where this is on PC or Linux), go to preferences and then Settings - Default to see what you can change (it's well commented). See the documentation here for all the places you can put settings for different things (like settings for one language or one project).
EDIT: I don't know what plugin you're talking about. You are linking to the install page to the excellent Package Control. Once you have typed that snippet into your console, you can press Command+Shift+P, type insp, hit enter, and search for your plugin to install it. After you install it (I assume you are talking about this plugin), you'll need to create an .editorconfig file at the highest-level directory for your project.
EDIT 2: I have a feeling your directory structure is wrong. Would you mind showing the directory structure of your project (feel free to change filenames if you feel the need to)? If you're on OS X, you can install a tree command with brew install tree. (If you don't have the excellent home brew package manager, go get that.) On Linux or even Windows, this should work out of the box. Anyways, grab the output of that. Otherwise, there could very well be a bug in the plugin, which you can' treacly do anything about unless you have the time to look at the source, hack on it and if your the kind of person who does this kind of thing make a pull request.
I found an answer here, but I think there is an error in that the translate_tabs_to_spaces must be set to true, not false.
So, basically, edit your Sublime settings-user file and add "translate_tabs_to_spaces": true
such that it overrides the default settings. I think this is a bug with the plugin as I would have expected EditorConfig to override the Sublime defaults. After all, is this not what you use EditorConfig to do in the first place?

Setting a windows icon that is located in a different assembly from XAML

From XAML, I am attempting to set the icon from the Window control.
The .ico file is located in a different assembly (no subfolders). I can get this to work when I just add the file to this assembly, but my goal is to make this work with having only the original .ico file, and having it stay where it is.
I have tried:
Icon="pack://application:,,,/ReferencedAssembly;component/IconFile.ico" as well as Icon="/ReferencedAssembly;component/IconFile.ico"
Even without the nasty blue squiggles, when I try to run I get errors of:
'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' with an InnerException of "Could not load file or assembly..... The System cannot find the file specified."
Win7, .NET 4
This seems like it should be simple enough, yet I am stumped. Thanks ahead of time.
Thanks to srsyogesh for helping get some additional error info.
I noticed it was failing to download the assembly initially, and that was a silly error on my part from failing to notice that that reference was completely missing.
With that fixed, it was followed by a "ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.", with an inner exception of "An attempt was made to load a program with an incorrect format". That was apparently caused by a conflict of "x86" vs "Any CPU" Platform Target in the build settings. Changed the one that said "Any CPU" to "x86", and voila.

Vim autocomplete from ctags for system headers only works when popup is triggered manually

On OS X, I generated a set of ctags for the system includes using the following command:
ctags -f c -h ".h" -R --c-kinds=+p --fields=+iaS --extra=+q /usr/include
This was run inside of a ~/.vim/ctags/ directory, where I put all of the ctags I generate for system-wide header files (I also have stuff for ROS and CPP that I load conditionally, but that's neither here nor there).
Anyway. The ctags file is set correctly in my .vimrc, and vim can definitely see the ctags, but for some reason the autocomplete popup will only display results from #included header files if I write out the entire symbol and then start backspacing. As an example, if I #include <string.h> in a project, and then I want to call strlen(), and I start to type str in to the active vim buffer, I will only get results for symbols that are currently in the vim buffer. But, if I type out strlen and then start backspacing one or two characters and hit <C-n>, the popup menu will be populated with matches from any other included header files.
EDIT: Turns out, if I just hit "s" then <C-n>, it works as well. So the problem seems to be that it only works if the popup menu is launched manually. Which makes me think that it's a plugin problem (see below)
Additional information:
completeopt is set to completeopt=menuone,menu,preview,longest
I have OmniCppComplete, which I suppose could be interfering with the behavior. It is currently not being conditionally loaded for C++ files only. If you want me to edit and post my OmniCppComplete settings from my .vimrc, just ask.
I also have AutoComplPop installed, but I haven't done anything to configure it, so it's running with its default settings. Haven't really researched the plugin, so no idea if some of it's behavior could be interfering with the results.
I have AutoTag and TagBar installed, but those should only be fiddling with the current directory's local tagfile.
I'm honestly pretty new to Vim, and I just have no idea where to start debugging this issue, whether it be with a random plugin or with my .vimrc settings.
Vim has many specific completion mechanisms.
<C-n> and <C-p> use many sources defined by the complete option. By default, they will provide completion using the current and all loaded and unloaded buffers, tags and included files. While you can usually get quite useful suggestions with these, it is a bit of a "catch-all" solution: it is not reliable at all if you work on reasonably large projects.
<C-x><C-]> uses only tags so it may be a little more useful to you.
And there are many more, see :h ins-completion.
Omni completion is smarter: it typically runs a custom filetype-specific script that tries hard to provide meaningful completion. It is triggered by <C-x><C-o> and you can read about it in :h ft-c-omni. Omni completion is often a better choice when working with code.
Because you have two overlaping "auto"-completion plugins it's hard to say what completion mechanism is at work. You should disable those plugins and play around with the different completion mechanisms available to you.
I have not mastered this yet, but I do think the following observation may be of help.
Vim's default auto complete which can be quite noisy, often gets in the way of what you call with <C-x><C-o>. Specifically, I found myself calling up my tags based completions with <C-x><C-o> only to have them replaced with continued typing with Vim's default suggestions using my open buffers.
The suggestion of shutting off one of the plugins makes sense. In my case the key was how to shut down Vim's default behavior. I have seen several people (and to which I now include myself), set the length of the expression to a high number before triggering Vim's default. For me that is:
let g:deoplete#auto_complete_start_length = 99
... this way you eliminate the default layer of completions that comes and goes regardless of the commands you intended to inform your work.
This still feels like a hack but it helps keep my work focused on the tag-based completions.
FYI: I use NVIM on a Mac.

Converting 2D XNA 4.0 project to silverlight 5.0

I followed the tutorial on http://silversprite.codeplex.com/ and got rid of a few issues that were expected (the colors etc). But there is 1 compile error left:
Error 2 The type 'Microsoft.Xna.Framework.Graphics.VertexDeclaration' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\Microsoft.Xna.Framework.Graphics.dll' and 'C:\Users\Brandon\Desktop\SilverSprite.dll' C:\Users\Brandon\Desktop\Projects\Other projects\Game Jam prac\Silverlight3dApp1\Silverlight3dApp1\Silverlight3dApp\VertexPositionColorNormal.cs 31
I've been searching for over an hour and can't find a solution.
The error means exactly what it says: There is a type, VertexDeclaration, that is being defined by both Silverlight and by SilverSprite. When your project tries to resolve which one to use - it can't decide.
SilverSprite is, and has always been, kind of buggy. This appears to be a bug in SilverSprite. It's coming from this file, which contains a declaration of VertexDeclaration which is nothing like the actual API.
Fortunately you don't have to implement it yourself - because Silverlight provides it. I suggest you download the SilverSprite source and include it as a project in your solution, and reference that instead of the DLL (ie: build SilverSprite from source yourself). Then you can easily modify it and simply delete the bogus type definition - your code will then automatically use the real one.
If you come across any other bugs, I suggest you look at ExEn. I made it last time I tried to use SilverSprite (although this was before Silverlight 5) - and I fixed many, many bugs. You might find it useful to salvage code from.

Resources