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

Commite706aed

Browse files
committed
mimicPathCompletionUtilities
This was removed from recent Roslyn builds and since very little functionality was used, the appropriate methods were simply ported over.
1 parente373e26 commite706aed

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

‎vsintegration/src/FSharp.Editor/Completion/FileSystemCompletion.fs‎

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ open System.Threading
1010
openSystem.Threading.Tasks
1111
openMicrosoft.CodeAnalysis
1212
openMicrosoft.CodeAnalysis.Completion
13-
openMicrosoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.FileSystem
1413
openMicrosoft.CodeAnalysis.Text
1514
openMicrosoft.CodeAnalysis.Classification
1615

@@ -35,15 +34,9 @@ type internal HashDirectiveCompletionProvider(workspace: Workspace, projectInfoM
3534

3635
letgetPathThroughLastSlash(text:SourceText,position:int,quotedPathGroup:Group)=
3736
PathCompletionUtilities.GetPathThroughLastSlash(
38-
quotedPath= quotedPathGroup.Value,
39-
quotedPathStart= getQuotedPathStart(text, position, quotedPathGroup),
40-
position= position)
41-
42-
letgetTextChangeSpan(text:SourceText,position:int,quotedPathGroup:Group)=
43-
PathCompletionUtilities.GetTextChangeSpan(
44-
quotedPath= quotedPathGroup.Value,
45-
quotedPathStart= getQuotedPathStart(text, position, quotedPathGroup),
46-
position= position)
37+
quotedPathGroup.Value,
38+
getQuotedPathStart(text, position, quotedPathGroup),
39+
position)
4740

4841
letgetFileGlyph(extention:string)=
4942
match extentionwith
@@ -117,30 +110,26 @@ type internal HashDirectiveCompletionProvider(workspace: Workspace, projectInfoM
117110
letsnapshot= text.FindCorrespondingEditorTextSnapshot()
118111

119112
do! Option.guard(not(isNull snapshot))
120-
letfileSystem= CurrentWorkingDirectoryDiscoveryService.GetService(snapshot)
121-
113+
122114
letextraSearchPaths=
123115
if completion.UseIncludeDirectivesthen
124116
getIncludeDirectives(text, position)
125117
else[]
126-
118+
127119
letdefaultSearchPath= Path.GetDirectoryName document.FilePath
128120
letsearchPaths= defaultSearchPath:: extraSearchPaths
129-
121+
130122
lethelper=
131123
FileSystemCompletionHelper(
132-
this,
133-
getTextChangeSpan(text, position, quotedPathGroup),
134-
fileSystem,
135124
Glyph.OpenFolder,
136125
completion.AllowableExtensions|> List.tryPick getFileGlyph|> Option.defaultValue Glyph.None,
137-
searchPaths= Seq.toImmutableArray searchPaths,
138-
allowableExtensions= completion.AllowableExtensions,
139-
itemRules= rules)
126+
Seq.toImmutableArray searchPaths,
127+
null,
128+
completion.AllowableExtensions|> Seq.toImmutableArray,
129+
rules)
140130

141131
letpathThroughLastSlash= getPathThroughLastSlash(text, position, quotedPathGroup)
142-
letdocumentPath=if document.Project.IsSubmissionthennullelse document.FilePath
143-
context.AddItems(helper.GetItems(pathThroughLastSlash, documentPath))
132+
context.AddItems(helper.GetItems(pathThroughLastSlash, ct))
144133
}
145134
|> Async.Ignore
146135
|> RoslynHelpers.StartAsyncUnitAsTask context.CancellationToken
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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.VisualStudio.FSharp.Editor
4+
5+
openSystem
6+
openSystem.IO
7+
8+
modulePathCompletionUtilities=
9+
letGetPathThroughLastSlash(quotedPath:string,quotedPathStart:int,position:int)=
10+
letquoteLength="\"".Length
11+
letpositionInQuotedPath= position- quotedPathStart
12+
letpath= quotedPath.Substring(quoteLength, positionInQuotedPath- quoteLength).Trim()
13+
letafterLastSlashIndex=
14+
letposition= Math.Min(path.Length, path.Length-1)
15+
letindex= path.LastIndexOf(Path.DirectorySeparatorChar, position)
16+
if index>=0then index+1else-1
17+
if afterLastSlashIndex>=0then path.Substring(0, afterLastSlashIndex)else path
18+
letEndsWithQuote(quotedPath:string)=
19+
quotedPath.Length>=2&& quotedPath.[quotedPath.Length-1]='"'

‎vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<CompileInclude="DocComments\XMLDocumentation.fs" />
6666
<CompileInclude="Completion\CompletionUtils.fs" />
6767
<CompileInclude="Completion\CompletionProvider.fs" />
68+
<CompileInclude="Completion\PathCompletionUtilities.fs" />
6869
<CompileInclude="Completion\FileSystemCompletion.fs" />
6970
<CompileInclude="Completion\CompletionService.fs" />
7071
<CompileInclude="Completion\SignatureHelp.fs" />

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp