-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35225 from genlu/FixRazorCompletion
Fix razor completion
- Loading branch information
Showing
21 changed files
with
247 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/EditorFeatures/Core.Wpf/Interactive/InteractiveSupportsFeatureService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Composition; | ||
using Microsoft.CodeAnalysis.Editor.Shared; | ||
using Microsoft.CodeAnalysis.Host.Mef; | ||
using Microsoft.VisualStudio.Text; | ||
using Microsoft.VisualStudio.InteractiveWindow; | ||
using Microsoft.CodeAnalysis.Shared; | ||
|
||
namespace Microsoft.CodeAnalysis.Editor.Implementation.Interactive | ||
{ | ||
internal sealed class InteractiveSupportsFeatureService | ||
{ | ||
[ExportWorkspaceService(typeof(ITextBufferSupportsFeatureService), WorkspaceKind.Interactive), Shared] | ||
internal class InteractiveTextBufferSupportsFeatureService : ITextBufferSupportsFeatureService | ||
{ | ||
public bool SupportsCodeFixes(ITextBuffer textBuffer) | ||
{ | ||
if (textBuffer != null) | ||
{ | ||
var evaluator = (IInteractiveEvaluator)textBuffer.Properties[typeof(IInteractiveEvaluator)]; | ||
var window = evaluator?.CurrentWindow; | ||
if (window?.CurrentLanguageBuffer == textBuffer) | ||
{ | ||
// These are only correct if we're on the UI thread. | ||
// Otherwise, they're guesses and they might change immediately even if they're correct. | ||
// If we return true and the buffer later becomes readonly, it appears that the | ||
// the code fix simply has no effect. | ||
return !window.IsResetting && !window.IsRunning; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public bool SupportsRefactorings(ITextBuffer textBuffer) | ||
{ | ||
return false; | ||
} | ||
|
||
public bool SupportsRename(ITextBuffer textBuffer) | ||
{ | ||
return false; | ||
} | ||
|
||
public bool SupportsNavigationToAnyPosition(ITextBuffer textBuffer) | ||
{ | ||
return true; | ||
} | ||
} | ||
|
||
[ExportWorkspaceService(typeof(IDocumentSupportsFeatureService), WorkspaceKind.Interactive), Shared] | ||
internal class InteractiveDocumentSupportsFeatureService : IDocumentSupportsFeatureService | ||
{ | ||
public bool SupportsCodeFixes(Document document) | ||
{ | ||
// TODO: Implement this. | ||
return false; | ||
} | ||
|
||
public bool SupportsRefactorings(Document document) | ||
{ | ||
return false; | ||
} | ||
|
||
public bool SupportsRename(Document document) | ||
{ | ||
return false; | ||
} | ||
|
||
public bool SupportsNavigationToAnyPosition(Document document) | ||
{ | ||
return true; | ||
} | ||
} | ||
} | ||
} |
49 changes: 0 additions & 49 deletions
49
src/EditorFeatures/Core.Wpf/Interactive/InteractiveTextBufferSupportsFeatureService.cs
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
src/EditorFeatures/Core/Shared/ITextBufferSupportsFeatureService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/Features/Core/Portable/Shared/IDocumentSupportsFeatureService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Composition; | ||
using Microsoft.CodeAnalysis.Host; | ||
using Microsoft.CodeAnalysis.Host.Mef; | ||
|
||
namespace Microsoft.CodeAnalysis.Shared | ||
{ | ||
internal interface IDocumentSupportsFeatureService : IWorkspaceService | ||
{ | ||
bool SupportsCodeFixes(Document document); | ||
bool SupportsRefactorings(Document document); | ||
bool SupportsRename(Document document); | ||
bool SupportsNavigationToAnyPosition(Document document); | ||
} | ||
|
||
|
||
[ExportWorkspaceService(typeof(IDocumentSupportsFeatureService), ServiceLayer.Default), Shared] | ||
internal class DefaultDocumentSupportsFeatureService : IDocumentSupportsFeatureService | ||
{ | ||
public bool SupportsCodeFixes(Document document) | ||
=> true; | ||
|
||
public bool SupportsNavigationToAnyPosition(Document document) | ||
=> true; | ||
|
||
public bool SupportsRefactorings(Document document) | ||
=> true; | ||
|
||
public bool SupportsRename(Document document) | ||
=> true; | ||
} | ||
} |
Oops, something went wrong.