Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> ValidKeywords
Expand Down Expand Up @@ -46,7 +48,7 @@ public IList<ClassificationSpan> 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()))
{
Expand Down
16 changes: 14 additions & 2 deletions src/Paket.VisualStudio/IntelliSense/CompletionContextType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ public enum CompletionContextType
InstalledNuGet,
Source,
Keyword,
Strategy
Strategy,
Framework,
Version,
Storage,
Content,
CopyToOutputDirectory,
CopyLocal,
ImportTargets,
DownloadLicense,
Redirects,
LowestMatching,
GenerateLoadScripts,
References
}
}
}
58 changes: 55 additions & 3 deletions src/Paket.VisualStudio/IntelliSense/CompletionEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,46 @@ private static ExportProvider ExportProvider
new PaketKeywordCompletionListProvider(ExportProvider.GetExport<IGlyphService>().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, "<any_paket_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<ICompletionListProvider> GetCompletionProviders(IIntellisenseSession session, ITextBuffer textBuffer, SnapshotPoint position, ITextStructureNavigator navigator, out CompletionContext context)
Expand Down Expand Up @@ -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)))
{
Expand All @@ -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) == " ")
{
Expand All @@ -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;
}

Expand Down Expand Up @@ -191,4 +243,4 @@ private static CompletionContext GetCompletionContext(PaketDocument paketDocumen
return context;
}
}
}
}