aspnet / Tooling

Issue tracker and info on Visual Studio tooling for ASP.NET
Other
256 stars 124 forks source link

Please add menu option to disable typescript compilation. #895

Open ciel opened 7 years ago

ciel commented 7 years ago

With a tsconfig.json file, we can configure Typescript ... in a way. Right now, we can disable it entirely by editing the *.csproj like this ...

<PropertyGroup>
    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
    <SchemaVersion>2.0</SchemaVersion>
  </PropertyGroup>

And that's okay. It works, at least. The reason to disable typescript in Visual Studio is because I'm using edge builds (npm install typescript@next --save) to do some of the newer things, and additionally, Visual Studio has a lot of trouble understanding even the old things at times. I kept getting errors about my typescript when I'd go to build a project.

While I understand that I have the manual project file editing option, this is kind of annoying. Yes, it is a very small piece of code, and yes, it was easy to do, but I still had to research and find something that should honestly be pretty standard.

If you're unwilling/unable to add the option to some manner of menu (*.csproj context menu? *.csproj -> Properties tab? Something?), then would you consider building in a .snippet for the disabling that shows up for users to find more easily? I've even created one for you.

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>tscblock</Title>
      <Author>
      </Author>
      <Description>
        Block typescript files from being compiled on build.
      </Description>
      <HelpUrl>
        https://www.typescriptlang.org/docs/handbook/compiler-options-in-msbuild.html
      </HelpUrl>
      <Shortcut>tscblock</Shortcut>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>version</ID>
          <ToolTip>The TypeScript version to block.</ToolTip>
          <Default>2.0</Default>
          <Function></Function>
        </Literal>
      </Declarations>
      <Code Language="xsd" Delimiter="$"><![CDATA[<PropertyGroup>
    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
    <SchemaVersion>$version$</SchemaVersion>
</PropertyGroup>]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

Until the schema supports intellisense for all of the new options in *.csproj, things like this might be useful.

mlorbetske commented 7 years ago

/cc @yuit

yuit commented 7 years ago

@billti, @mhegazy, @paulvanbrenk thought on this?

mhegazy commented 7 years ago

Sounds like a reasonable suggestion.

billti commented 7 years ago

What seems like a reasonable suggestion? I don't think snippets for compiler options are the way to go.

We have quite a number of options which aren't on the Properties page. This one used to have a check box if I remember rightly. I'll look into it.

mhegazy commented 7 years ago

What seems like a reasonable suggestion? I don't think snippets for compiler options are the way to go

If you have a tsconfig.json in your project, the whole property page is disabled. but MSBuild is still building your project. The suggestion is to add a check box to disallow the MSBuild integration.