Giter Site home page Giter Site logo

nshader's Introduction

NShader

Build status

This is a fork of Issam Khalil's Visual Studio 2013 fork of Alexandre Mutel's NShader syntax highlighting Visual Studio extension for shader languages. I've cloned it into my own github repository as I prefer to use github rather than CodePlex. The original nshader project is available here:

https://nshader.codeplex.com/

I have made some changes to Issam's version. You may now override the file type detection by specifying, on the first line of a shader file, a comment like so:

// shadertype=<type>

where <type> is one of:

hlsl
glsl
cg
unity

This will force the file to use the specified syntax highlighter. This is case sensitive and must appear exactly as above. Otherwise if the shadertype tag is not present, the file extension will be used to decide what type of highlighting to use. The extension mapping is as follows:

HLSL syntax highlighter - .fx, .fxh, .hlsl, .vsh, .psh, .fsh, .usf, .slfx
GLSL syntax highlighter - .glsl, .frag, .vert, .fp, .vp, .geom, .xsh, .comp, .sfx
CG syntax highlighter - .cg, .cgfx
Unity syntax highlighter - .shader, .cginc, .compute

You can also add extra extensions in Tools->Options->Text Editor->File Extension. Type in the file extension, select "NShader Editor" in the dropdown, and click "Add". Then when you open a file with any of those extensions they will use the NShader syntax highlighter. It seems that there is a bug in at least Visual Studio 2013 and possibly earlier versions where the setting can be forgotten and when you open a file in the list the syntax highlighting is not applied. However, the extension still appears in the list. To work around this you must remove and re-add the extension to the list. Also in Visual Studio 2015 if you load a file from the "recently used" list it doesn't seem to use the syntax highlighter, but if you load it from elsewhere (e.g. file->open or the Solution Explorer) it will work. This seems like a bug in Visual Studio, because it worked in VS 2013.

Note that if you add a file extension or use the shadertype tag you will need to close and re-open any currently open files to reflect the changes.

The existing file extensions that NShader previously recognised are still recognised, so if you are using any of those file types you don't have to do anything extra.

The user keyword mapping files now override the built-in mappings (in Issam's version duplicates were ignored). NShader will look inside %APPDATA%\NShader for custom map files with the following names:

GLSLKeywords.map
HLSLKeywords.map
UNITYKeywords.map

Any keywords in these files will replace the built-in mapping. For example, if float is mapped as a type in the built-in mapping, it can be changed to a keyword by adding it to the override file. Note that the CG highlighter is the same as the HLSL highlighter, so it doesn't have its own mapping. I've also made some small changes to the built-in mappings so that certain keywords are now 'types' instead of 'keywords'.

Finally, there is now an additional colour setting for the 'type' keywords (available in the Fonts and Colors dialog).

The latest build is available from Github in the releases section:

https://github.com/samizzo/nshader

The above build can be used to install NShader in VS 2013, 2015, and 2017.

This README and the built-in mappings are available in the zip file for reference.

nshader's People

Contributors

ikhalil avatar nicolaichuk avatar samizzo avatar yazgoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nshader's Issues

Serious bug...

... is not what this is. I just wanted to thank you for maintaining this! Strangely enough it was a bit hard to find though, I think you should recommend it in some different forums and perhaps get the word out.

I only ever found the original NShader which doesn't work for 2013/2015.

Thank you again!

VS 2017 Community — "The extension is not installable on any currently installed products"

I tried running the latest version (2.4) using the VSIX Installer, and got this error. I am using VisualStudio 2017 Community.

Install log:

3/9/2018 2:59:07 PM - Microsoft VSIX Installer
3/9/2018 2:59:07 PM - -------------------------------------------
3/9/2018 2:59:07 PM - vsixinstaller.exe version:
3/9/2018 2:59:07 PM - 15.6.152+ge95e4dd1ce
3/9/2018 2:59:07 PM - -------------------------------------------
3/9/2018 2:59:07 PM - Command line parameters:
3/9/2018 2:59:07 PM - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\Users\johna\Downloads\NShader.vsix
3/9/2018 2:59:07 PM - -------------------------------------------
3/9/2018 2:59:07 PM - Microsoft VSIX Installer
3/9/2018 2:59:07 PM - -------------------------------------------
3/9/2018 2:59:07 PM - Found setup instance e26cb0d0 but not in launchable state.
3/9/2018 2:59:07 PM - Initializing Install...
3/9/2018 2:59:07 PM - Extension Details...
3/9/2018 2:59:07 PM - Identifier : NShader.51a01e9d-eb56-4ee2-a9fd-8212bf6bf2b1
3/9/2018 2:59:07 PM - Name : NShader
3/9/2018 2:59:07 PM - Author : Alexandre Mutel
3/9/2018 2:59:07 PM - Version : 2.4
3/9/2018 2:59:07 PM - Description : NShader is an extension to Visual Studio that provides syntax highlighting for various shader languages including HLSL - GLSL - CG
3/9/2018 2:59:07 PM - Locale : en-US
3/9/2018 2:59:07 PM - MoreInfoURL : https://github.com/samizzo/nshader
3/9/2018 2:59:07 PM - InstalledByMSI : False
3/9/2018 2:59:07 PM - SupportedFrameworkVersionRange : [4.5,)
3/9/2018 2:59:07 PM -
3/9/2018 2:59:07 PM - SignatureState : Unsigned
3/9/2018 2:59:07 PM - Supported Products :
3/9/2018 2:59:07 PM - Microsoft.VisualStudio.Pro
3/9/2018 2:59:07 PM - Version : [12.0,15.0]
3/9/2018 2:59:07 PM - Microsoft.VisualStudio.Enterprise
3/9/2018 2:59:07 PM - Version : [12.0,15.0]
3/9/2018 2:59:07 PM - Microsoft.VisualStudio.Ultimate
3/9/2018 2:59:07 PM - Version : [12.0,15.0]
3/9/2018 2:59:07 PM - Microsoft.VisualStudio.Premium
3/9/2018 2:59:07 PM - Version : [12.0,15.0]
3/9/2018 2:59:07 PM -
3/9/2018 2:59:07 PM - References :
3/9/2018 2:59:07 PM - -------------------------------------------------------
3/9/2018 2:59:07 PM - Identifier : Microsoft.VisualStudio.MPF.12.0
3/9/2018 2:59:07 PM - Name : Visual Studio MPF 12.0
3/9/2018 2:59:07 PM - Version : [12.0]
3/9/2018 2:59:07 PM - MoreInfoURL :
3/9/2018 2:59:07 PM - Nested : No
3/9/2018 2:59:07 PM -
3/9/2018 2:59:07 PM - Prerequisites :
3/9/2018 2:59:07 PM - -------------------------------------------------------
3/9/2018 2:59:07 PM - Identifier : Microsoft.VisualStudio.Component.CoreEditor
3/9/2018 2:59:07 PM - Name : Visual Studio core editor
3/9/2018 2:59:07 PM - Version : [15.0.26208.0,16.0)
3/9/2018 2:59:07 PM -
3/9/2018 2:59:07 PM - Signature Details...
3/9/2018 2:59:07 PM - Extension is not signed.
3/9/2018 2:59:07 PM -
3/9/2018 2:59:07 PM - Searching for applicable products...
3/9/2018 2:59:07 PM - Found installed product - Global Location
3/9/2018 2:59:07 PM - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
at VSIXInstaller.App.GetInstallableData(String vsixPath, Boolean isRepairSupported, IEnumerable1& skuData) at VSIXInstaller.App.Initialize(Boolean isRepairSupported) at VSIXInstaller.App.Initialize() at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Any plans to add VS2017 compatibility?

Hi, Sam -

I've grown very accustomed to having this add-in as part of my VS environment. I'd be heartbroken if I had to leave it behind as I migrate to VS2017...

Signed:
A concerned fan.

Use file extensions supported by the GLSL reference compiler

While GLSL does not mandate any extension for shader sources, the reference compiler expects the following mapping :

.vert - a vertex shader
.tesc - a tessellation control shader
.tese - a tessellation evaluation shader
.geom - a geometry shader
.frag - a fragment shader
.comp - a compute shader

NShader should support all those extensions as it's the closest thing to a standard.

NShader doesn't seem to work with Nsight installed

I have Visual Studio 2015 (with Nsight) and Visual Studio 2017. NShader just working on Visual Studio 2017. When using Visual Studio 2015 (with Nsight) to open the GLSL file, it’s just a normal text editor.
But on my other computer only Visual Studio 2015 (with Nsight), NShader can work.

No highlighting on fresh VS2017 installation

I've been reading the previous issues and trying every solution, including disabling all the other extensions and reinstalling VS2017 Community (15.3.5). The issue is that no highlighting ever appears on my shader files, and there is no nShader section under Options although "Shader Language" does appear under the Text Editor section. Enabling, disabling, and reinstalling the extension doesn't seem to do anything either, except that with the extension enabled I get no highlighting at all and with it disabled I get the basic highlighting. Opening the file through a solution, manually, or creating a new shader file results in the same thing.

The extension appears in About section, and there are no errors. Going through the activity log and searching for "nShader" yields zero results. Don't really know where to go from there.

screenshot 686

Latest release does not work in Visual Studio 2015 (Community Edition)

These are the relevant lines from the Log:

  <entry>
    <record>470</record>
    <time>2017/03/20 09:33:29.121</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [NShader]</description>
    <guid>{DD9B8CDE-96A0-4442-BF6F-083A7F43D453}</guid>
  </entry>
  <entry>
    <record>471</record>
    <time>2017/03/20 09:33:29.136</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>CreateInstance failed for package [NShader]Source: &apos;mscorlib&apos; Description: Could not load file or assembly &apos;Microsoft.VisualStudio.Shell.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;System.IO.FileNotFoundException: Could not load file or assembly &apos;Microsoft.VisualStudio.Shell.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;File name: &apos;Microsoft.VisualStudio.Shell.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos;&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)&#x000D;&#x000A;   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)&#x000D;&#x000A;   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)&#x000D;&#x000A;&#x000D;&#x000A;WRN: Assembly binding logging is turned OFF.&#x000D;&#x000A;To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.&#x000D;&#x000A;Note: There is some performance penalty associated with assembly bind failure logging.&#x000D;&#x000A;To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].&#x000D;&#x000A;</description>
    <guid>{DD9B8CDE-96A0-4442-BF6F-083A7F43D453}</guid>
    <hr>80004005 - E_FAIL</hr>
    <errorinfo></errorinfo>
  </entry>

Version 2.1 works fine though, so I guess something broke when you added VS2017 support.

Please post a .vsix file

Been trying to get this to work in VS2015 for hours now and can't seem to. Says its already installed, but it isn't.

Outdated readme

Not a big issue, but readme doesn't include Unreal Engine 4 support.

Unreal Engine 4 syntax highlighter - .usf

NShader not working initially in VS2017

Split off from issue #12:

"I just installed NShader in 2017 and had the same problem as Xirema. I got it to work by disabling NShader, restarting Visual Studio, re-enabling Visual Studio and then restarting again."

Add project to Visual Studio Marketplace

I really appreciate the work done on this, but it would be great to be able to download it from the "Extensions and Updates" window within Visual Studio.

Any chance of that happening?

'Fonts and Colors' entries don't appear in VS2017

Hi, Sam -

Bad news, I'm afraid. While the new version does appear to have installed in VS2017, none of the 'fonts and colors' entries (e.g., 'NShader - Comment') appear in the options dialog. The add-in DOES seem to have installed - it appears in the 'Extensions and Updates' dialog as an installed Add-in.

And here's a possible clue - when I ran the installer, two VS versions appeared in the list as available to have the add-in installed - VS2015 Pro and VS2017 Pro. I unchecked VS2015 (as the previous rev was already installed there), and checked the VS2017 checkbox, and started the install. Installer reported success on finish. I then opened VS2015, and after it had finished initializing, opened VS2017. Here's the thing - VS2015 displayed the sequence of dialogs at start-up you typically see when an add-in is installed - you know, 'scanning mef components', 'building mef components graph', or something like that. VS2017 showed no such dialog sequence at start-up - it made no indication that an add-in had been installed.

Again - I hadn't select VS2015, but had selected VS2017.

I hope this is useful info.

No color settings in VS 2015

The title is self-explanatory.
Just installed the latest release (2.4) of this ext to the VS 2015 - and there's no syntax highlighting at all. More importantly, no way to specify it manually because there are no "NShader – Type" settings under Tools > Options > Environment > Fonts and Colors.

Tried uninstalling and re-instaloing the ext, also tried version prior to VS 2017 support (2.1) - the same thing.

shadertype doesn't work in VS2015

I have two shader files with extensions .fs and .vs. I have put // shadertype=glsl as the first line of the two files but there's no syntax highlighting. Changing the extensions to .frag and .vert works.

Running VS2015 Community.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.