Skip to content
Merged
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
2 changes: 1 addition & 1 deletion docs/fcs/caches.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../artifacts/bin/fcs/net461"
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
Compiler Services: Notes on the FSharpChecker caches
=================================================
Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/compiler.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../artifacts/bin/fcs/net461"
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
Hosted Compiler
===============
Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/corelib.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../artifacts/bin/fcs/net461"
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
Compiler Services: Notes on FSharp.Core.dll
=================================================
Expand Down
6 changes: 2 additions & 4 deletions docs/fcs/editor.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../artifacts/bin/fcs/net461"
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
Compiler Services: Editor services
==================================
Expand Down Expand Up @@ -166,8 +166,7 @@ where we need to perform the completion.
// Get declarations (autocomplete) for a location
let decls =
checkFileResults.GetDeclarationListInfo
(Some parseFileResults, 7, inputLines.[6], PartialLongName.Empty 23, (fun () -> []), fun _ -> false)
|> Async.RunSynchronously
(Some parseFileResults, 7, inputLines.[6], PartialLongName.Empty 23, (fun () -> []))

// Print the names of available items
for item in decls.Items do
Expand Down Expand Up @@ -199,7 +198,6 @@ changes):
// Get overloads of the String.Concat method
let methods =
checkFileResults.GetMethods(5, 27, inputLines.[4], Some ["String"; "Concat"])
|> Async.RunSynchronously

// Print concatenated parameter lists
for mi in methods.Methods do
Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/filesystem.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../artifacts/bin/fcs/net461"
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
Compiler Services: Virtualized File System
==========================================
Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/interactive.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../artifacts/bin/fcs/net461"
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
Interactive Service: Embedding F# Interactive
=============================================
Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/ja/compiler.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../../artifacts/bin/fcs/net461"
#I "../../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
コンパイラの組み込み
====================
Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/ja/corelib.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../../artifacts/bin/fcs/net461"
#I "../../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
コンパイラサービス: FSharp.Core.dll についてのメモ
==================================================
Expand Down
16 changes: 8 additions & 8 deletions docs/fcs/ja/editor.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../../artifacts/bin/fcs/net461"
#I "../../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
コンパイラサービス: エディタサービス
====================================
Expand Down Expand Up @@ -29,6 +29,7 @@

open System
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.Text

// インタラクティブチェッカーのインスタンスを作成
let checker = FSharpChecker.Create()
Expand Down Expand Up @@ -56,7 +57,7 @@ printfn "%s" msg.
let inputLines = input.Split('\n')
let file = "/home/user/Test.fsx"

let projOptions, _errors1 = checker.GetProjectOptionsFromScript(file, input) |> Async.RunSynchronously
let projOptions, _errors1 = checker.GetProjectOptionsFromScript(file, SourceText.ofString input) |> Async.RunSynchronously

let parsingOptions, _errors2 = checker.GetParsingOptionsFromProjectOptions(projOptions)

Expand All @@ -73,7 +74,7 @@ let parsingOptions, _errors2 = checker.GetParsingOptionsFromProjectOptions(projO
*)
// パースを実行
let parseFileResults =
checker.ParseFile(file, input, parsingOptions)
checker.ParseFile(file, SourceText.ofString input, parsingOptions)
|> Async.RunSynchronously
(**
`TypeCheckResults` に備えられた興味深い機能の紹介に入る前に、
Expand All @@ -84,15 +85,15 @@ F#コードにエラーがあった場合も何らかの型チェックの結果

// 型チェックを実行
let checkFileAnswer =
checker.CheckFileInProject(parseFileResults, file, 0, input, projOptions)
checker.CheckFileInProject(parseFileResults, file, 0, SourceText.ofString input, projOptions)
|> Async.RunSynchronously

(**
あるいは `ParseAndCheckFileInProject` を使用すれば1つの操作で両方のチェックを行うことができます:
*)

let parseResults2, checkFileAnswer2 =
checker.ParseAndCheckFileInProject(file, 0, input, projOptions)
checker.ParseAndCheckFileInProject(file, 0, SourceText.ofString input, projOptions)
|> Async.RunSynchronously

(**
Expand Down Expand Up @@ -178,8 +179,7 @@ printfn "%A" tip
// 特定の位置における宣言(自動補完)を取得する
let decls =
checkFileResults.GetDeclarationListInfo
(Some parseFileResults, 7, inputLines.[6], PartialLongName.Empty 23, (fun _ -> []), fun _ -> false)
|> Async.RunSynchronously
(Some parseFileResults, 7, inputLines.[6], PartialLongName.Empty 23, (fun _ -> []))

// 利用可能な項目を表示
for item in decls.Items do
Expand Down Expand Up @@ -213,7 +213,7 @@ for item in decls.Items do
*)
//String.Concatメソッドのオーバーロードを取得する
let methods =
checkFileResults.GetMethods(5, 27, inputLines.[4], Some ["String"; "Concat"]) |> Async.RunSynchronously
checkFileResults.GetMethods(5, 27, inputLines.[4], Some ["String"; "Concat"])

// 連結された引数リストを表示
for mi in methods.Methods do
Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/ja/filesystem.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../../artifacts/bin/fcs/net461"
#I "../../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
コンパイラサービス: ファイルシステム仮想化
==========================================
Expand Down
6 changes: 3 additions & 3 deletions docs/fcs/ja/interactive.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../../artifacts/bin/fcs/net461"
#I "../../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
インタラクティブサービス: F# Interactiveの組み込み
==================================================
Expand Down Expand Up @@ -55,8 +55,8 @@ open System.IO
open System.Text

// 入出力のストリームを初期化
let sbOut = new StringBuilder()
let sbErr = new StringBuilder()
let sbOut = StringBuilder()
let sbErr = StringBuilder()
let inStream = new StringReader("")
let outStream = new StringWriter(sbOut)
let errStream = new StringWriter(sbErr)
Expand Down
9 changes: 4 additions & 5 deletions docs/fcs/ja/project.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../../artifacts/bin/fcs/net461"
#I "../../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
コンパイラサービス: プロジェクトの分析
======================================
Expand All @@ -25,6 +25,7 @@
open System
open System.Collections.Generic
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.Text

// インタラクティブチェッカーのインスタンスを作成
let checker = FSharpChecker.Create()
Expand Down Expand Up @@ -157,7 +158,6 @@ let backgroundParseResults1, backgroundTypedParse1 =

let xSymbol =
backgroundTypedParse1.GetSymbolUseAtLocation(9,9,"",["xxx"])
|> Async.RunSynchronously

(**
それぞれのシンボルに対して、シンボルへの参照を検索することもできます:
Expand Down Expand Up @@ -187,7 +187,7 @@ let allUsesOfAllSymbols = wholeProjectResults.GetAllUsesOfAllSymbols()

*)
let parseResults1, checkAnswer1 =
checker.ParseAndCheckFileInProject(Inputs.fileName1, 0, Inputs.fileSource1, projectOptions)
checker.ParseAndCheckFileInProject(Inputs.fileName1, 0, SourceText.ofString Inputs.fileSource1, projectOptions)
|> Async.RunSynchronously

let checkResults1 =
Expand All @@ -196,7 +196,7 @@ let checkResults1 =
| _ -> failwith "想定外の終了状態です"

let parseResults2, checkAnswer2 =
checker.ParseAndCheckFileInProject(Inputs.fileName2, 0, Inputs.fileSource2, projectOptions)
checker.ParseAndCheckFileInProject(Inputs.fileName2, 0, SourceText.ofString Inputs.fileSource2, projectOptions)
|> Async.RunSynchronously

let checkResults2 =
Expand All @@ -210,7 +210,6 @@ let checkResults2 =

let xSymbol2 =
checkResults1.GetSymbolUseAtLocation(9,9,"",["xxx"])
|> Async.RunSynchronously

let usesOfXSymbol2 = wholeProjectResults.GetUsesOfSymbol(xSymbol2.Value.Symbol)

Expand Down
7 changes: 4 additions & 3 deletions docs/fcs/ja/symbols.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../../artifacts/bin/fcs/net461"
#I "../../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
コンパイラサービス: シンボルの処理
==================================
Expand All @@ -22,6 +22,7 @@
open System
open System.IO
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.Text

// インタラクティブチェッカーのインスタンスを作成
let checker = FSharpChecker.Create()
Expand Down Expand Up @@ -77,7 +78,7 @@ type C() =
member x.P = 1
"""
let parseFileResults, checkFileResults =
parseAndTypeCheckSingleFile(file, input2)
parseAndTypeCheckSingleFile(file, SourceText.ofString input2)

(**
これでコードに対する部分的なアセンブリのシグネチャが取得できるようになります:
Expand Down Expand Up @@ -204,7 +205,7 @@ for assembly in projectContext.GetReferencedAssemblies() do
*)
let parseAndCheckScript (file, input) =
let projOptions, errors =
checker.GetProjectOptionsFromScript(file, input)
checker.GetProjectOptionsFromScript(file, SourceText.ofString input)
|> Async.RunSynchronously

let projResults =
Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/ja/tokenizer.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../../artifacts/bin/fcs/net461"
#I "../../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
コンパイラサービス:F#トークナイザを使用する
============================================
Expand Down
9 changes: 5 additions & 4 deletions docs/fcs/ja/untypedtree.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../../artifacts/bin/fcs/net461"
#I "../../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
コンパイラサービス:型無し構文木の処理
======================================
Expand Down Expand Up @@ -42,6 +42,7 @@
#r "FSharp.Compiler.Service.dll"
open System
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.Text
(**

### 型無しパースの実行
Expand Down Expand Up @@ -70,14 +71,14 @@ let getUntypedTree (file, input) =
// 1つのスクリプトファイルから推測される「プロジェクト」用の
// コンパイラオプションを取得する
let projOptions, errors =
checker.GetProjectOptionsFromScript(file, input)
checker.GetProjectOptionsFromScript(file, SourceText.ofString input)
|> Async.RunSynchronously

let parsingOptions, _errors = checker.GetParsingOptionsFromProjectOptions(projOptions)

// コンパイラの第1フェーズを実行する
let untypedRes =
checker.ParseFile(file, input, parsingOptions)
checker.ParseFile(file, SourceText.ofString input, parsingOptions)
|> Async.RunSynchronously

match untypedRes.ParseTree with
Expand All @@ -101,7 +102,7 @@ ASTを理解するには

ASTに関連する要素は以下の名前空間に含まれています:
*)
open FSharp.Compiler.Ast
open FSharp.Compiler.SyntaxTree
(**

ASTを処理する場合、異なる文法的要素に対するパターンマッチを行うような
Expand Down
13 changes: 2 additions & 11 deletions docs/fcs/project.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../artifacts/bin/fcs/net461"
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
Compiler Services: Project Analysis
==================================
Expand Down Expand Up @@ -175,7 +175,6 @@ You can now resolve symbols in each file:

let xSymbolUseOpt =
backgroundTypedParse1.GetSymbolUseAtLocation(9,9,"",["xxx"])
|> Async.RunSynchronously

let xSymbolUse = xSymbolUseOpt.Value

Expand All @@ -196,22 +195,20 @@ For each symbol, you can look up the references to that symbol:
*)
let usesOfXSymbol =
wholeProjectResults.GetUsesOfSymbol(xSymbol)
|> Async.RunSynchronously

(**
You can iterate all the defined symbols in the inferred signature and find where they are used:
*)
let allUsesOfAllSignatureSymbols =
[ for s in allSymbols do
let uses = wholeProjectResults.GetUsesOfSymbol(s) |> Async.RunSynchronously
let uses = wholeProjectResults.GetUsesOfSymbol(s)
yield s.ToString(), uses ]

(**
You can also look at all the symbols uses in the whole project (including uses of symbols with local scope)
*)
let allUsesOfAllSymbols =
wholeProjectResults.GetAllUsesOfAllSymbols()
|> Async.RunSynchronously

(**
You can also request checks of updated versions of files within the project (note that the other files
Expand Down Expand Up @@ -243,34 +240,28 @@ Again, you can resolve symbols and ask for references:

let xSymbolUse2Opt =
checkResults1.GetSymbolUseAtLocation(9,9,"",["xxx"])
|> Async.RunSynchronously

let xSymbolUse2 = xSymbolUse2Opt.Value

let xSymbol2 = xSymbolUse2.Symbol

let usesOfXSymbol2 =
wholeProjectResults.GetUsesOfSymbol(xSymbol2)
|> Async.RunSynchronously


(**
Or ask for all the symbols uses in the file (including uses of symbols with local scope)
*)
let allUsesOfAllSymbolsInFile1 =
checkResults1.GetAllUsesOfAllSymbolsInFile()
|> Async.RunSynchronously

(**
Or ask for all the uses of one symbol in one file:
*)
let allUsesOfXSymbolInFile1 =
checkResults1.GetUsesOfSymbolInFile(xSymbol2)
|> Async.RunSynchronously

let allUsesOfXSymbolInFile2 =
checkResults2.GetUsesOfSymbolInFile(xSymbol2)
|> Async.RunSynchronously

(**

Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/queue.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../artifacts/bin/fcs/net461"
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
Compiler Services: Notes on the FSharpChecker operations queue
=================================================
Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/react.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../../artifacts/bin/fcs/net461"
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
(**
Compiler Services: Reacting to Changes
============================================
Expand Down
Loading