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

Commitc7e276a

Browse files
authored
Merge pull request #3856 from Microsoft/merges/master-to-dev15.6-20171101-070044
Merge master to dev15.6
2 parentsdd0538e +4ad577f commitc7e276a

File tree

4 files changed

+116
-110
lines changed

4 files changed

+116
-110
lines changed

‎vsintegration/Vsix/VisualFSharpTemplates/Source.extension.vsixmanifest‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<PackageId>Microsoft.FSharp.VSIX.Templates</PackageId>
1010
<MoreInfo>https://docs.microsoft.com/en-us/dotnet/articles/fsharp/</MoreInfo>
1111
</Metadata>
12-
<Installation>
12+
<InstallationExperimental="true">
1313
<InstallationTargetId="Microsoft.VisualStudio.Pro"Version="[15.0]" />
1414
</Installation>
1515
<Dependencies>

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ type internal FSharpCompletionProvider
3434
inherit CompletionProvider()
3535

3636
static letuserOpName="CompletionProvider"
37-
static letcompletionTriggers=[|'.'|]
3837
static letdeclarationItemsCache= ConditionalWeakTable<string, FSharpDeclarationListItem>()
3938
static let [<Literal>]NameInCodePropName="NameInCode"
4039
static let [<Literal>]FullNamePropName="FullName"
@@ -87,18 +86,15 @@ type internal FSharpCompletionProvider
8786
lettriggerPosition= caretPosition-1
8887
letc= sourceText.[triggerPosition]
8988

90-
if completionTriggers|> Array.contains cthen
91-
true
92-
9389
// do not trigger completion if it's not single dot, i.e. range expression
94-
elif triggerPosition>0&& sourceText.[triggerPosition-1]='.'then
90+
ifnot Settings.IntelliSense.ShowAfterCharIsTyped&& sourceText.[triggerPosition-1]='.'then
9591
false
9692

9793
// Trigger completion if we are on a valid classification type
9894
else
9995
letdocumentId,filePath,defines= getInfo()
10096
CompletionUtils.shouldProvideCompletion(documentId, filePath, defines, sourceText, triggerPosition)&&
101-
(Settings.IntelliSense.ShowAfterCharIsTyped&& CompletionUtils.isStartingNewWord(sourceText, triggerPosition))
97+
(c='.'||(Settings.IntelliSense.ShowAfterCharIsTyped&& CompletionUtils.isStartingNewWord(sourceText, triggerPosition)))
10298

10399
static memberProvideCompletionsAsyncAux(checker:FSharpChecker,sourceText:SourceText,caretPosition:int,options:FSharpProjectOptions,filePath:string,
104100
textVersionHash:int,getAllSymbols:unit->AssemblySymbol list)=

‎vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs‎

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,16 @@ open System.Linq
1515
openSystem.Runtime.CompilerServices
1616
openSystem.Runtime.InteropServices
1717
openSystem.Threading
18-
19-
openMicrosoft.FSharp.Compiler.CompileOps
20-
openMicrosoft.FSharp.Compiler.SourceCodeServices
21-
openMicrosoft.VisualStudio.FSharp.LanguageService.SiteProvider
22-
2318
openMicrosoft.CodeAnalysis
2419
openMicrosoft.CodeAnalysis.Diagnostics
2520
openMicrosoft.CodeAnalysis.Completion
2621
openMicrosoft.CodeAnalysis.Options
22+
openMicrosoft.FSharp.Compiler.CompileOps
23+
openMicrosoft.FSharp.Compiler.SourceCodeServices
2724
openMicrosoft.VisualStudio
2825
openMicrosoft.VisualStudio.Editor
26+
openMicrosoft.VisualStudio.FSharp.LanguageService
27+
openMicrosoft.VisualStudio.FSharp.LanguageService.SiteProvider
2928
openMicrosoft.VisualStudio.TextManager.Interop
3029
openMicrosoft.VisualStudio.LanguageServices
3130
openMicrosoft.VisualStudio.LanguageServices.Implementation.LanguageService
@@ -34,7 +33,6 @@ open Microsoft.VisualStudio.LanguageServices.Implementation.TaskList
3433
openMicrosoft.VisualStudio.LanguageServices.ProjectSystem
3534
openMicrosoft.VisualStudio.Shell
3635
openMicrosoft.VisualStudio.Shell.Interop
37-
openMicrosoft.VisualStudio.FSharp.LanguageService
3836
openMicrosoft.VisualStudio.ComponentModelHost
3937

4038
// Exposes FSharpChecker as MEF export
@@ -89,7 +87,7 @@ type internal FSharpCheckerProvider
8987
// It also allows a 'cheaper' route to get the project options relevant to parsing (e.g. the #define values).
9088
// The main entrypoints are TryGetOptionsForDocumentOrProject and TryGetOptionsForEditingDocumentOrProject.
9189
[<Export(typeof<FSharpProjectOptionsManager>); Composition.Shared>]
92-
typeinternalFSharpProjectOptionsManager
90+
typeinternalFSharpProjectOptionsManager
9391
[<ImportingConstructor>]
9492
(
9593
checkerProvider: FSharpCheckerProvider,
@@ -114,33 +112,36 @@ type internal FSharpProjectOptionsManager
114112
/// Clear a project from the project table
115113
memberthis.ClearInfoForProject(projectId:ProjectId)= projectOptionsTable.ClearInfoForProject(projectId)
116114

115+
/// Clear a project from the single file project table
117116
memberthis.ClearInfoForSingleFileProject(projectId)=
118117
singleFileProjectTable.TryRemove(projectId)|> ignore
119118

119+
/// Update a project in the single file project table
120120
memberthis.AddOrUpdateSingleFileProject(projectId,data)= singleFileProjectTable.[projectId]<- data
121121

122122
/// Get the exact options for a single-file script
123-
memberthis.ComputeSingleFileOptions(tryGetOrCreateProjectId,fileName,loadTime,fileContents,workspace:Workspace)=async{
124-
letextraProjectInfo= Some(box workspace)
125-
lettryGetOptionsForReferencedProject f= f|> tryGetOrCreateProjectId|> Option.bind this.TryGetOptionsForProject|> Option.map(fun(_,_,projectOptions)-> projectOptions)
126-
if SourceFile.MustBeSingleFileProject(fileName)then
127-
// NOTE: we don't use a unique stamp for single files, instead comparing options structurally.
128-
// This is because we repeatedly recompute the options.
129-
letoptionsStamp= None
130-
let!options,_diagnostics= checkerProvider.Checker.GetProjectOptionsFromScript(fileName, fileContents, loadTime,[||], ?extraProjectInfo=extraProjectInfo, ?optionsStamp=optionsStamp)
131-
// NOTE: we don't use FCS cross-project references from scripts to projects. THe projects must have been
132-
// compiled and #r will refer to files on disk
133-
letreferencedProjectFileNames=[||]
134-
letsite= ProjectSitesAndFiles.CreateProjectSiteForScript(fileName, referencedProjectFileNames, options)
135-
letdeps,projectOptions= ProjectSitesAndFiles.GetProjectOptionsForProjectSite(Settings.LanguageServicePerformance.EnableInMemoryCrossProjectReferences, tryGetOptionsForReferencedProject, site, serviceProvider,(tryGetOrCreateProjectId fileName), fileName, options.ExtraProjectInfo, Some projectOptionsTable,true)
136-
letparsingOptions,_= checkerProvider.Checker.GetParsingOptionsFromProjectOptions(projectOptions)
137-
return(deps, parsingOptions, projectOptions)
138-
else
139-
letsite= ProjectSitesAndFiles.ProjectSiteOfSingleFile(fileName)
140-
letdeps,projectOptions= ProjectSitesAndFiles.GetProjectOptionsForProjectSite(Settings.LanguageServicePerformance.EnableInMemoryCrossProjectReferences, tryGetOptionsForReferencedProject, site, serviceProvider,(tryGetOrCreateProjectId fileName), fileName, extraProjectInfo, Some projectOptionsTable,true)
141-
letparsingOptions,_= checkerProvider.Checker.GetParsingOptionsFromProjectOptions(projectOptions)
142-
return(deps, parsingOptions, projectOptions)
143-
}
123+
memberthis.ComputeSingleFileOptions(tryGetOrCreateProjectId,fileName,loadTime,fileContents)=
124+
async{
125+
letextraProjectInfo= Some(box workspace)
126+
lettryGetOptionsForReferencedProject f= f|> tryGetOrCreateProjectId|> Option.bind this.TryGetOptionsForProject|> Option.map(fun(_,_,projectOptions)-> projectOptions)
127+
if SourceFile.MustBeSingleFileProject(fileName)then
128+
// NOTE: we don't use a unique stamp for single files, instead comparing options structurally.
129+
// This is because we repeatedly recompute the options.
130+
letoptionsStamp= None
131+
let!options,_diagnostics= checkerProvider.Checker.GetProjectOptionsFromScript(fileName, fileContents, loadTime,[||], ?extraProjectInfo=extraProjectInfo, ?optionsStamp=optionsStamp)
132+
// NOTE: we don't use FCS cross-project references from scripts to projects. THe projects must have been
133+
// compiled and #r will refer to files on disk
134+
letreferencedProjectFileNames=[||]
135+
letsite= ProjectSitesAndFiles.CreateProjectSiteForScript(fileName, referencedProjectFileNames, options)
136+
letdeps,projectOptions= ProjectSitesAndFiles.GetProjectOptionsForProjectSite(Settings.LanguageServicePerformance.EnableInMemoryCrossProjectReferences, tryGetOptionsForReferencedProject, site, serviceProvider,(tryGetOrCreateProjectId fileName), fileName, options.ExtraProjectInfo, Some projectOptionsTable,true)
137+
letparsingOptions,_= checkerProvider.Checker.GetParsingOptionsFromProjectOptions(projectOptions)
138+
return(deps, parsingOptions, projectOptions)
139+
else
140+
letsite= ProjectSitesAndFiles.ProjectSiteOfSingleFile(fileName)
141+
letdeps,projectOptions= ProjectSitesAndFiles.GetProjectOptionsForProjectSite(Settings.LanguageServicePerformance.EnableInMemoryCrossProjectReferences, tryGetOptionsForReferencedProject, site, serviceProvider,(tryGetOrCreateProjectId fileName), fileName, extraProjectInfo, Some projectOptionsTable,true)
142+
letparsingOptions,_= checkerProvider.Checker.GetParsingOptionsFromProjectOptions(projectOptions)
143+
return(deps, parsingOptions, projectOptions)
144+
}
144145

145146
/// Update the info for a project in the project table
146147
memberthis.UpdateProjectInfo(tryGetOrCreateProjectId,projectId,site,userOpName)=
@@ -164,32 +165,34 @@ type internal FSharpProjectOptionsManager
164165
|_-> FSharpParsingOptions.Default
165166
CompilerEnvironment.GetCompilationDefinesForEditing(document.Name, parsingOptions)
166167

168+
/// Try and get the Options for a project
167169
memberthis.TryGetOptionsForProject(projectId:ProjectId)= projectOptionsTable.TryGetOptionsForProject(projectId)
168170

169171
/// Get the exact options for a document or project
170-
memberthis.TryGetOptionsForDocumentOrProject(document:Document)=async{
171-
letprojectId= document.Project.Id
172-
173-
// The options for a single-file script project are re-requested each time the file is analyzed. This is because the
174-
// single-file project may contain #load and #r references which are changing as the user edits, and we may need to re-analyze
175-
// to determine the latest settings. FCS keeps a cache to help ensure these are up-to-date.
176-
match singleFileProjectTable.TryGetValue(projectId)with
177-
|true,(loadTime,_,_)->
178-
try
179-
letfileName= document.FilePath
180-
let!cancellationToken= Async.CancellationToken
181-
let!sourceText= document.GetTextAsync(cancellationToken)|> Async.AwaitTask
182-
// NOTE: we don't use FCS cross-project references from scripts to projects. The projects must have been
183-
// compiled and #r will refer to files on disk.
184-
lettryGetOrCreateProjectId _= None
185-
let!_referencedProjectFileNames,parsingOptions,projectOptions= this.ComputeSingleFileOptions(tryGetOrCreateProjectId, fileName, loadTime, sourceText.ToString(), document.Project.Solution.Workspace)
186-
this.AddOrUpdateSingleFileProject(projectId,(loadTime, parsingOptions, projectOptions))
187-
return Some(parsingOptions, None, projectOptions)
188-
with ex->
189-
Assert.Exception(ex)
190-
return None
191-
|_->return this.TryGetOptionsForProject(projectId)
192-
}
172+
memberthis.TryGetOptionsForDocumentOrProject(document:Document)=
173+
async{
174+
letprojectId= document.Project.Id
175+
176+
// The options for a single-file script project are re-requested each time the file is analyzed. This is because the
177+
// single-file project may contain #load and #r references which are changing as the user edits, and we may need to re-analyze
178+
// to determine the latest settings. FCS keeps a cache to help ensure these are up-to-date.
179+
match singleFileProjectTable.TryGetValue(projectId)with
180+
|true,(loadTime,_,_)->
181+
try
182+
letfileName= document.FilePath
183+
let!cancellationToken= Async.CancellationToken
184+
let!sourceText= document.GetTextAsync(cancellationToken)|> Async.AwaitTask
185+
// NOTE: we don't use FCS cross-project references from scripts to projects. The projects must have been
186+
// compiled and #r will refer to files on disk.
187+
lettryGetOrCreateProjectId _= None
188+
let!_referencedProjectFileNames,parsingOptions,projectOptions= this.ComputeSingleFileOptions(tryGetOrCreateProjectId, fileName, loadTime, sourceText.ToString())
189+
this.AddOrUpdateSingleFileProject(projectId,(loadTime, parsingOptions, projectOptions))
190+
return Some(parsingOptions, None, projectOptions)
191+
with ex->
192+
Assert.Exception(ex)
193+
return None
194+
|_->return this.TryGetOptionsForProject(projectId)
195+
}
193196

194197
/// Get the options for a document or project relevant for syntax processing.
195198
/// Quicker then TryGetOptionsForDocumentOrProject as it doesn't need to recompute the exact project options for a script.
@@ -540,7 +543,7 @@ type
540543
letprojectDisplayName= projectDisplayNameOf projectFileName
541544

542545
letprojectId= workspace.ProjectTracker.GetOrCreateProjectIdForPath(projectFileName, projectDisplayName)
543-
let_referencedProjectFileNames,parsingOptions,projectOptions= projectInfoManager.ComputeSingleFileOptions(tryGetOrCreateProjectId workspace, fileName, loadTime, fileContents, workspace)|> Async.RunSynchronously
546+
let_referencedProjectFileNames,parsingOptions,projectOptions= projectInfoManager.ComputeSingleFileOptions(tryGetOrCreateProjectId workspace, fileName, loadTime, fileContents)|> Async.RunSynchronously
544547
projectInfoManager.AddOrUpdateSingleFileProject(projectId,(loadTime, parsingOptions, projectOptions))
545548

546549
if isNull(workspace.ProjectTracker.GetProject projectId)then

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp