diff --git a/src/Paket.VisualStudio/IntelliSense/Classifier/PaketDependenciesClassifier.cs b/src/Paket.VisualStudio/IntelliSense/Classifier/PaketDependenciesClassifier.cs index 1a4e2ba70..ec25c402e 100644 --- a/src/Paket.VisualStudio/IntelliSense/Classifier/PaketDependenciesClassifier.cs +++ b/src/Paket.VisualStudio/IntelliSense/Classifier/PaketDependenciesClassifier.cs @@ -15,7 +15,9 @@ internal class PaketDependenciesClassifier : IClassifier { "source", "nuget", "github", "gist", "http", "content", "references", "redirects", "group", - "strategy" + "strategy", "framework", "version", "storage", "content", + "copy_content_to_output_dir", "copy_local", "import_targets", + "download_license", "lowest_matching", "generate_load_scripts" }; public static IEnumerable ValidKeywords @@ -46,7 +48,7 @@ public IList GetClassificationSpans(SnapshotSpan span) { var trimmed = text.TrimStart(); var offset = text.Length - trimmed.Length; - string[] args = trimmed.Split(' '); + string[] args = trimmed.Split(' ', ':'); if (args.Length >= 2 && ValidKeywords.Contains(args[0].Trim().ToLowerInvariant())) { diff --git a/src/Paket.VisualStudio/IntelliSense/CompletionContextType.cs b/src/Paket.VisualStudio/IntelliSense/CompletionContextType.cs index 31ebadb1a..28df88042 100644 --- a/src/Paket.VisualStudio/IntelliSense/CompletionContextType.cs +++ b/src/Paket.VisualStudio/IntelliSense/CompletionContextType.cs @@ -6,6 +6,18 @@ public enum CompletionContextType InstalledNuGet, Source, Keyword, - Strategy + Strategy, + Framework, + Version, + Storage, + Content, + CopyToOutputDirectory, + CopyLocal, + ImportTargets, + DownloadLicense, + Redirects, + LowestMatching, + GenerateLoadScripts, + References } -} \ No newline at end of file +} diff --git a/src/Paket.VisualStudio/IntelliSense/CompletionEngine.cs b/src/Paket.VisualStudio/IntelliSense/CompletionEngine.cs index 01fb4f857..5fb714f9b 100644 --- a/src/Paket.VisualStudio/IntelliSense/CompletionEngine.cs +++ b/src/Paket.VisualStudio/IntelliSense/CompletionEngine.cs @@ -35,7 +35,46 @@ private static ExportProvider ExportProvider new PaketKeywordCompletionListProvider(ExportProvider.GetExport().Value), new NuGetNameCompletionListProvider(), new SourceCompletionListProvider(), - new SimpleOptionCompletionListProvider(CompletionContextType.Strategy, "min", "max") + new SimpleOptionCompletionListProvider(CompletionContextType.Strategy, "min", "max"), + new SimpleOptionCompletionListProvider(CompletionContextType.Framework, + "auto-detect", + "net35", + "net40", + "net45", + "net451", + "net452", + "net46", + "net461", + "net462", + "net47", + "netstandard1.0", + "netstandard1.1", + "netstandard1.2", + "netstandard1.3", + "netstandard1.4", + "netstandard1.5", + "netstandard1.6", + "netstandard2.0", + "netcoreapp1.0", + "netcoreapp1.1", + "netcoreapp2.0", + "uap", + "wp7", + "wp75", + "wp8", + "wp81", + "wpa81"), + new SimpleOptionCompletionListProvider(CompletionContextType.Version, "", "--prefer-nuget"), + new SimpleOptionCompletionListProvider(CompletionContextType.Storage, "none", "packages", "symlink"), + new SimpleOptionCompletionListProvider(CompletionContextType.Content, "none", "once"), + new SimpleOptionCompletionListProvider(CompletionContextType.CopyToOutputDirectory, "always", "never", "preserve_newest"), + new SimpleOptionCompletionListProvider(CompletionContextType.CopyLocal, "true", "false"), + new SimpleOptionCompletionListProvider(CompletionContextType.ImportTargets, "true", "false"), + new SimpleOptionCompletionListProvider(CompletionContextType.DownloadLicense, "true", "false"), + new SimpleOptionCompletionListProvider(CompletionContextType.Redirects, "off", "on", "force"), + new SimpleOptionCompletionListProvider(CompletionContextType.LowestMatching, "true", "false"), + new SimpleOptionCompletionListProvider(CompletionContextType.GenerateLoadScripts, "true", "false"), + new SimpleOptionCompletionListProvider(CompletionContextType.References, "strict"), }; public static IEnumerable GetCompletionProviders(IIntellisenseSession session, ITextBuffer textBuffer, SnapshotPoint position, ITextStructureNavigator navigator, out CompletionContext context) @@ -70,7 +109,7 @@ private static CompletionContext GetCompletionContext(PaketDocument paketDocumen { TextExtent endPosition = navigator.GetExtentOfWord(position - 1); TextExtent startPosition = endPosition; - + // try to extend the span over . while (!String.IsNullOrWhiteSpace(paketDocument.GetCharAt(startPosition.Span.Start.Position - 1))) { @@ -89,6 +128,7 @@ private static CompletionContext GetCompletionContext(PaketDocument paketDocumen pos = startPosition.Span.Start - 1; TextExtent previous = navigator.GetExtentOfWord(pos); + // try to extend the span over blanks while (paketDocument.GetCharAt(previous.Span.Start.Position) == " ") { @@ -105,6 +145,18 @@ private static CompletionContext GetCompletionContext(PaketDocument paketDocumen case "nuget": context.ContextType = CompletionContextType.NuGet; break; case "source": context.ContextType = CompletionContextType.Source; break; case "strategy": context.ContextType = CompletionContextType.Strategy; break; + case "framework": context.ContextType = CompletionContextType.Framework; break; + case "version": context.ContextType = CompletionContextType.Version; break; + case "storage": context.ContextType = CompletionContextType.Storage; break; + case "content": context.ContextType = CompletionContextType.Content; break; + case "copy_content_to_output_dir": context.ContextType = CompletionContextType.CopyToOutputDirectory; break; + case "copy_local": context.ContextType = CompletionContextType.CopyLocal; break; + case "import_targets": context.ContextType = CompletionContextType.ImportTargets; break; + case "download_license": context.ContextType = CompletionContextType.DownloadLicense; break; + case "redirects": context.ContextType = CompletionContextType.Redirects; break; + case "lowest_matching": context.ContextType = CompletionContextType.LowestMatching; break; + case "generate_load_scripts": context.ContextType = CompletionContextType.GenerateLoadScripts; break; + case "references": context.ContextType = CompletionContextType.References; break; default: context.ContextType = CompletionContextType.Keyword; break; } @@ -191,4 +243,4 @@ private static CompletionContext GetCompletionContext(PaketDocument paketDocumen return context; } } -} \ No newline at end of file +}