Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita7697d6

Browse files
dungpaKevinRansom
authored andcommitted
Implement XmlDoc comment generation (dotnet#2121)
* Add a service for XmlDocParser* Add corresponding VS service* Use VS workspace to retrieve correct documents* Use current snapshot to ensure source text is fresh
1 parentb5bf291 commita7697d6

File tree

6 files changed

+430
-94
lines changed

6 files changed

+430
-94
lines changed

‎src/fsharp/FSharp.LanguageService.Compiler/FSharp.LanguageService.Compiler.fsproj‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,9 @@
553553
<CompileInclude="..\vs\ServiceAssemblyContent.fs">
554554
<Link>Service/ServiceAssemblyContent.fs</Link>
555555
</Compile>
556+
<CompileInclude="..\vs\ServiceXmlDocParser.fs">
557+
<Link>Service/ServiceXmlDocParser.fs</Link>
558+
</Compile>
556559
<CompileInclude="..\vs\service.fsi">
557560
<Link>Service/service.fsi</Link>
558561
</Compile>

‎src/fsharp/vs/ServiceInterfaceStubGenerator.fs‎

Lines changed: 3 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespaceMicrosoft.FSharp.Compiler.SourceCodeServices
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
2+
3+
namespaceMicrosoft.FSharp.Compiler.SourceCodeServices
24

35
openSystem
46
openSystem.Diagnostics
@@ -7,98 +9,6 @@ open Microsoft.FSharp.Compiler
79
openMicrosoft.FSharp.Compiler.Ast
810
openMicrosoft.FSharp.Compiler.Range
911
openMicrosoft.FSharp.Compiler.SourceCodeServices
10-
11-
[<RequireQualifiedAccess>]
12-
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
13-
moduleArray=
14-
/// pass an array byref to reverse it in place
15-
letrevInPlace(array:'T[])=
16-
if Array.isEmpty arraythen()else
17-
letarrlen,revlen= array.Length-1, array.Length/2-1
18-
for idxin0.. revlendo
19-
lett1= array.[idx]
20-
lett2= array.[arrlen-idx]
21-
array.[idx]<- t2
22-
array.[arrlen-idx]<- t1
23-
24-
/// Async implementation of Array.map.
25-
letmapAsync(mapping:'T->Async<'U>)(array:'T[]):Async<'U[]>=
26-
letlen= Array.length array
27-
letresult= Array.zeroCreate len
28-
29-
async{// Apply the mapping function to each array element.
30-
for iin0.. len-1do
31-
let!mappedValue= mapping array.[i]
32-
result.[i]<- mappedValue
33-
34-
// Return the completed results.
35-
return result
36-
}
37-
38-
[<RequireQualifiedAccess>]
39-
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
40-
moduleString=
41-
openSystem.IO
42-
43-
let inlinetoCharArray(str:string)= str.ToCharArray()
44-
45-
letlowerCaseFirstChar(str:string)=
46-
if String.IsNullOrEmpty str
47-
|| Char.IsLower(str,0)then strelse
48-
letstrArr= toCharArray str
49-
match Array.tryHead strArrwith
50-
| None-> str
51-
| Some c->
52-
strArr.[0]<- Char.ToLower c
53-
String(strArr)
54-
55-
letextractTrailingIndex(str:string)=
56-
match strwith
57-
|null->null, None
58-
|_->
59-
letcharr= str.ToCharArray()
60-
Array.revInPlace charr
61-
letdigits= Array.takeWhile Char.IsDigit charr
62-
Array.revInPlace digits
63-
String digits
64-
|>function
65-
|""-> str, None
66-
| index-> str.Substring(0, str.Length- index.Length), Some(int index)
67-
68-
/// Remove all trailing and leading whitespace from the string
69-
/// return null if the string is null
70-
lettrim(value:string)=if isNull valuethennullelse value.Trim()
71-
72-
/// Splits a string into substrings based on the strings in the array separators
73-
letsplit options(separator:string[])(value:string)=
74-
if isNull valuethennullelse value.Split(separator, options)
75-
76-
let(|StartsWith|_|)pattern value=
77-
if String.IsNullOrWhiteSpace valuethen
78-
None
79-
elif value.StartsWith patternthen
80-
Some()
81-
else None
82-
83-
let(|Contains|_|)pattern value=
84-
if String.IsNullOrWhiteSpace valuethen
85-
None
86-
elif value.Contains patternthen
87-
Some()
88-
else None
89-
90-
letgetLines(str:string)=
91-
use reader=new StringReader(str)
92-
[|
93-
letline= ref(reader.ReadLine())
94-
whilenot(isNull!line)do
95-
yield!line
96-
line:= reader.ReadLine()
97-
if str.EndsWith("\n")then
98-
// last trailing space not returned
99-
// http://stackoverflow.com/questions/19365404/stringreader-omits-trailing-linebreak
100-
yield String.Empty
101-
|]
10212

10313
[<AutoOpen>]
10414
moduleinternalCodeGenerationUtils=

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp