Skip to content

Commit

Permalink
"dependencies" can refer to a range
Browse files Browse the repository at this point in the history
  • Loading branch information
georgewfraser committed Jun 13, 2018
1 parent a51f437 commit 851b13d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/FSharpLanguageServer/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ let private testFunctions(parse: FSharpParseFileResults): (string list * Ast.Syn
match string with
// TODO check for open NUnit.Framework before accepting plain "Test"
| "Test" | "NUnit.Framework.Test" -> true
| _ -> dprintfn "%s is not [<Test>]" string; false
| _ -> false
let isTestFunction(binding: Ast.SynBinding): bool =
let attrs = match binding with Ast.Binding(_, _, _, _, attrs, _, _, _, _, _, _, _) -> attrs
List.exists isTestAttribute attrs
Expand All @@ -122,7 +122,7 @@ let private testFunctions(parse: FSharpParseFileResults): (string list * Ast.Syn
seq {
match m with
| Ast.SynModuleDecl.NestedModule(outer, _, decls, _, _) ->
let ids = match outer with Ast.ComponentInfo(_, _, _, ids, _, _, _, _) -> ids
let ids = match outer with Ast.ComponentInfo(_, _, _, ids, _, _, _, _) -> ids
let ctx = ctx@[for i in ids do yield i.idText]
for d in decls do
yield! bindings(ctx, d)
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpLanguageServer/ProjectManager.fs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ type ProjectManager(client: ILanguageClient, checker: FSharpChecker) =
for key in analyzedByProjectFile.Keys do
walk(key)
List.ofSeq(result)
//// All transitive dependencies of `projectFile`, in dependency order
/// All transitive dependencies of `projectFile`, in dependency order
member this.TransitiveDeps(projectFile: FileInfo): FSharpProjectOptions list =
transitiveDeps(projectFile)
/// Is `targetSourceFile` visible from `fromSourceFile`?
Expand Down
7 changes: 5 additions & 2 deletions src/ProjectCracker/ProjectCracker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,11 @@ let private parseProjectAssets(projectAssetsJson: FileInfo): ProjectAssets =
match root?targets.[longFramework].[nameVersion].TryGetProperty("dependencies") with
| None -> ()
| Some(next) ->
for name, version in next.Properties do
let dep = {name=name; version=version.AsString(); autoReferenced=false}
for name, _ in next.Properties do
// The version in "dependencies" can be a range like [1.0, 2.0),
// so we will use the version from targets
let version = chooseVersion(name)
let dep = {name=name; version=version; autoReferenced=false}
findTransitiveDeps(dep)
// Find root dependencies by scanning the project section
// "project": {
Expand Down

0 comments on commit 851b13d

Please sign in to comment.