tgjones / HlslTools

A Visual Studio extension that provides enhanced support for editing High Level Shading Language (HLSL) files
http://timjones.io/blog/archive/2016/04/25/hlsl-tools-for-visual-studio-v1.0-released
Other
562 stars 97 forks source link

IIncludeFileSystem improvements #130

Open mrvux opened 5 years ago

mrvux commented 5 years ago

Hello,

I just wanted to discuss some improvements about using IIncludeFileSystem .

The first issue is that we do not have information about include Type (in comparison versus standard Direct3D), so in some advanced scenarii it's impossible to decide which file to add (or to eventually add no file).

The second issue is error handling in case file is not found :

SourceText GetInclude(string path)

Should we return a null (in the current case it seems that returning null simply replaces text by empty string), or throw an exception?

We could also have a try api instead, like :

GetIncludeResult TryGetInclude(string path, IncludeType ncludeType)

And have GetIncludeResult as a sum type instead (that either have a sourcetext or some message?

mrvux commented 5 years ago

Ah about try include, I noticed my version was way out of date, so yes seems try was nicer indeed.