2020-10-16 08:43:02 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
type dotnet struct {
|
2020-12-27 23:33:58 -08:00
|
|
|
language *language
|
2020-10-16 08:43:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
2020-11-12 00:43:32 -08:00
|
|
|
// UnsupportedDotnetVersionIcon is displayed when the dotnet version in
|
|
|
|
// the current folder isn't supported by the installed dotnet SDK set.
|
2020-10-16 08:43:02 -07:00
|
|
|
UnsupportedDotnetVersionIcon Property = "unsupported_version_icon"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (d *dotnet) string() string {
|
2020-12-27 23:33:58 -08:00
|
|
|
version := d.language.string()
|
2020-10-16 08:43:02 -07:00
|
|
|
|
2020-12-27 23:33:58 -08:00
|
|
|
// Exit code 145 is a special indicator that dotnet
|
|
|
|
// ran, but the current project config settings specify
|
|
|
|
// use of an SDK that isn't installed.
|
|
|
|
if d.language.exitCode == 145 {
|
|
|
|
return d.language.props.getString(UnsupportedDotnetVersionIcon, "\uf071 ")
|
2020-10-16 08:43:02 -07:00
|
|
|
}
|
|
|
|
|
2020-12-27 23:33:58 -08:00
|
|
|
return version
|
2020-10-16 08:43:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (d *dotnet) init(props *properties, env environmentInfo) {
|
2020-12-27 23:33:58 -08:00
|
|
|
d.language = &language{
|
|
|
|
env: env,
|
|
|
|
props: props,
|
|
|
|
commands: []string{"dotnet"},
|
|
|
|
versionParam: "--version",
|
|
|
|
extensions: []string{"*.cs", "*.vb", "*.sln", "*.csproj", "*.vbproj"},
|
2021-01-10 03:14:43 -08:00
|
|
|
version: &version{
|
|
|
|
regex: `(?:(?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?:\d{2})(?P<patch>[0-9]{1}))))`,
|
|
|
|
urlTemplate: "[%1s](https://github.com/dotnet/core/blob/master/release-notes/%[2]s.%[3]s/%[2]s.%[3]s.%[4]s/%[2]s.%[3]s.%[4]s.md)",
|
|
|
|
},
|
2020-12-27 23:33:58 -08:00
|
|
|
}
|
2020-10-16 08:43:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (d *dotnet) enabled() bool {
|
2020-12-27 23:33:58 -08:00
|
|
|
return d.language.enabled()
|
2020-10-16 08:43:02 -07:00
|
|
|
}
|