Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Coloring fails on Copy (Ctrl+C) #333

Closed
captkirk88 opened this issue Aug 25, 2024 · 21 comments
Closed

Code Coloring fails on Copy (Ctrl+C) #333

captkirk88 opened this issue Aug 25, 2024 · 21 comments
Assignees
Labels
bug Highlight Syntax highlight

Comments

@captkirk88
Copy link

As mentioned in #330 I am experiencing the same issue in the latest VS 2022 update.

Microsoft Visual Studio Community 2022 (64-bit)
Version 17.11.1

Happens exactly when I use Copy shortcut Ctrl+C then don't even paste, either hitting Enter to make a new line or less often just using Ctrl+C and the coloring is removed. I disabled the extensions I believed could be causing this potential for a conflict in which they modify the active document in some way but the issue still occurs.

@wmjordan
Copy link
Owner

Does this issue occur on any type of code document types, e.g. C#, HTML and Markdown. or just a specific document type, e.g. C# only?

When this issue occurs again, please do the following:

  1. Open the Options page
  2. Check the Add "Show Active Window Properties" command to File Menu checkbox.
    image
  3. Click into the code window where the syntax highlight is lost.
  4. Execute "Show Active Window Properties" command from the File menu
  5. Copy the content from the following window alike and paste it here.
    image

@wmjordan wmjordan added no can repro Unable to reproduce the problem Highlight Syntax highlight labels Aug 25, 2024
@captkirk88
Copy link
Author

I tried HTML and it doesn't show any syntax highlighting for those files. I don't have any syntax highlighter extension for html. I didn't know Codist could highlight html.

Only part I edited were the paths to files and project names.

Document Properties
FilePath = ...\CameraOcculsionSystem.cs
Text Encoding = Unicode (UTF-8)
Last Saved = 8/25/2024 6:56:31 AM
Last Modified = 8/25/2024 7:02:23 AM
IWpfTextView
TextSnapshot.LineCount (Line Count) = 35
TextSnapshot.Length (Character Count) = 1017
Selection = [590-590)
Selection Length = 0
SelectedSpans.Count = 1
Caret.Position = 590
Caret.OverwriteMode = false
Caret.ContainingTextViewLine.Extent.Length = 35
ViewportLeft = 0
ViewportTop = 120
ViewportWidth = 956.917525773196
ViewportHeight = 624
VisualElement.ActualWidth = 956.917525773196
VisualElement.ActualHeight = 623.092783505155
TextViewLines.Count = 30
TextBuffer.ContentType:
CSharp
Roslyn Languages
code
text
any
code-languageserver-base
languageserver-base
Roles = DEBUGGABLE,PRIMARYDOCUMENT,ANALYZABLE,DOCUMENT,EDITABLE,INTERACTIVE,STRUCTURED,ZOOMABLE,UBIDIFF,UBIRIGHTDIFF
Properties:
Additional Command Execution Context: List`1<OleCommandExecutionArgs>
BottomRightCornerSpacerMargin: BottomRightCornerSpacerMargin
BraceCompletionManager: BraceCompletionManager
CaretAdornmentLayer: CaretAdornmentLayer
CollapsedAdornmentProvider: CollapsedAdornmentProvider
CommentTagger: CommentTagger+CSharpCommentTagger
CompletionTelemetryRepository: CompletionTelemetryRepository
CSharpParser: CSharpParser
CtrlKeyStateTracker: CtrlKeyStateTracker
CurrentLineHighlighter: CurrentLineHighlighter
DefaultCompletionPresenter: DefaultCompletionPresenter
DefaultSignatureHelpPresenter: DefaultSignatureHelpPresenter
Dictionary`2<WeakReferenceForDictionaryKey,PopupAgent+PopupOrWindowContainer>: Dictionary`2<WeakReferenceForDictionaryKey,PopupAgent+PopupOrWindowContainer>
DifferenceBrushManager: DifferenceBrushManager
DocumentHighlightTagger: DocumentHighlightTagger
DropDownMargin: DropDownMargin
EditingState: EditingState
Editor.View: DefaultTextViewPrimitive
EditorCommandHandlerService: EditorCommandHandlerService
EditorContextTextViewId: 6
EditorOperationsFactoryService: EditorOperations
FeatureService: FeatureService
FindScopeHighlightTagger: FindScopeHighlightTagger
FormatStore: FormatStore
FullLineAdornmentManager: FullLineAdornmentManager
GoToDefKeyProcessor: GoToDefKeyProcessor
GoToDefMouseHandler: GoToDefMouseHandler
HeaderMargin: HeaderMargin
IAsyncCompletionSource: SuggestionCompletionSource
IBraceCompletionAdornmentService: BraceCompletionAdornmentService
ICompletionBroker: CompletionBroker
IDragDropMouseProcessor: DragDropMouseProcessor
IEditorOptions: EditorOptions
IIntellisenseSessionStack: IntellisenseSessionStack
ILightBulbSession: LightBulbSession
IMouseProcessor: ZoomMouseProcessor
IMultiSelectionBroker: MultiSelectionBroker
InlayHintsTagger: InlayHintsTagger
InlineCompletionsInstance: InlineCompletionsInstance
InlineCSharpProposalManager: InlineCSharpProposalManager
InputController: InputController
IntellisenseManager: IntellisenseManager
IntellisenseSourceCache+ViewSourceCache`1<AsyncQuickInfoSession+OrderedSource>: IntellisenseSourceCache+ViewSourceCache`1<AsyncQuickInfoSession+OrderedSource>
IntellisenseSourceCache+ViewSourceCache`1<INavigableSymbolSource>: IntellisenseSourceCache+ViewSourceCache`1<INavigableSymbolSource>
IntellisenseSourceCache+ViewSourceCache`1<ISignatureHelpSource>: IntellisenseSourceCache+ViewSourceCache`1<ISignatureHelpSource>
IntellisenseSourceCache+ViewSourceCache`1<SuggestedActionsSourceWithMetadata>: IntellisenseSourceCache+ViewSourceCache`1<SuggestedActionsSourceWithMetadata>
InterLineAdornmentManager: InterLineAdornmentManager
IntraTextAdornmentTagger: IntraTextAdornmentTagger
InvisibleControlCharacterTagger: InvisibleControlCharacterTagger
IOleCommandTarget: VsTextViewAdapter
IOutliningManager: OutliningManager
ITagAggregator`1<IErrorTag>: TagAggregator`1<IErrorTag>
ITagger`1<InterLineAdornmentTag>: CodeLensInterLineAdornmentTaggerProvider+CodeLensInterLineAdornmentTagger
ITextStructureNavigatorSelectorService: TextStructureNavigatorSelectorService
ITextViewExtensions+AutoClosingViewProperty`2<AbstractOleCommandTarget,IWpfTextView>: ITextViewExtensions+AutoClosingViewProperty`2<AbstractOleCommandTarget,IWpfTextView>
ITextViewExtensions+AutoClosingViewProperty`2<InlineRenameAdornmentManager,IWpfTextView>: ITextViewExtensions+AutoClosingViewProperty`2<InlineRenameAdornmentManager,IWpfTextView>
ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<BraceHighlightTag>,ITextView>: ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<BraceHighlightTag>,ITextView>
ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<IClassificationTag>,ITextView>: ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<IClassificationTag>,ITextView>
ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<InheritanceMarginTag>,ITextView>: ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<InheritanceMarginTag>,ITextView>
ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<InlineHintDataTag>,ITextView>: ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<InlineHintDataTag>,ITextView>
ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<ITextMarkerTag>,ITextView>: ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<ITextMarkerTag>,ITextView>
ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<KeywordHighlightTag>,ITextView>: ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<KeywordHighlightTag>,ITextView>
ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<NavigableHighlightTag>,ITextView>: ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<NavigableHighlightTag>,ITextView>
ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<StringIndentationTag>,ITextView>: ITextViewExtensions+PerSubjectBufferProperty`2<AbstractAsynchronousTaggerProvider`1<>+TagSource<StringIndentationTag>,ITextView>
ITextViewExtensions+PerSubjectBufferProperty`2<Controller,ITextView>: ITextViewExtensions+PerSubjectBufferProperty`2<Controller,ITextView>
ITextViewExtensions+PerSubjectBufferProperty`2<NavigableSymbolService+NavigableSymbolSource,ITextView>: ITextViewExtensions+PerSubjectBufferProperty`2<NavigableSymbolService+NavigableSymbolSource,ITextView>
IVsCodeWindow: VsCodeWindowAdapter
IVsTextView: VsTextViewAdapter
LightBulbController: LightBulbController
LightBulbTagger: LightBulbTagger
LinkedEditingRangeHandler: LinkedEditingRangeHandler
Microsoft.VisualStudio.Editor.Telemetry.EditorInstance: 18
ModifierKeyStateTracker: ModifierKeyStateTracker
MultiSelectionCommandState: MultiSelectionCommandState
MultiSelectionMouseHandler: MultiSelectionMouseHandler
MultiSelectionMouseState: MultiSelectionMouseState
NaviBar: Codist.NaviBar.CSharpBar Header: Items.Count:7
NavigableSymbolClassifier: NavigableSymbolClassifier
NegativeSpaceAdornmentManager: NegativeSpaceAdornmentManager
OutliningWholeLineHighlighter: OutliningWholeLineHighlighter
OvertypeManagerFactory: OvertypeManager
OverviewMarginContextMenu: System.Windows.Controls.ContextMenu Items.Count:12
PeekInterLineAdornmentTagger: PeekInterLineAdornmentTagger
PotentialCommitCharacters: System.Collections.Immutable.ImmutableArray`1[System.Char]
PreviewManager: PreviewManager
ProposalBroker: ProposalBroker
RemoteLanguageInitialized: true
SelectionAdornmentLayer: SelectionAdornmentLayer
SemanticContext: SemanticContext
ShimCompletionController: ShimCompletionController
ShimQuickInfoController: ShimQuickInfoController
ShimSignatureHelpController: ShimSignatureHelpController
SmartIndentationService: SmartIndent
SnippetTaggerProvider+SnippetTagger: SnippetTaggerProvider+SnippetTagger
StructureContextManager: StructureContextManager
StructureManager: StructureManager
StructureSpanningTreeManager: StructureSpanningTreeManager
SuggestionBroker: SuggestionBroker
SuggestionCommitManagerFactory+SuggestionCommitManager: SuggestionCommitManagerFactory+SuggestionCommitManager
SuggestionCompletionCommitManagerProvider: SuggestionCompletionCommitManager
TaggerResult: TaggerResult
TargetType=Microsoft.VisualStudio.Language.Intellisense.CodeLensTextViewProperties ID=ActiveAdornmentHost: CodeLensInterLineAdornmentTaggerProvider+CodeLensInterLineAdornmentTagger+AdornmentHost
TargetType=Microsoft.VisualStudio.Language.Intellisense.CodeLensTextViewProperties ID=ShowAccessKeys: true
TextBufferVisibilityService: TextBufferVisibilityService
TextSearchTaggerManager: TextSearchTaggerManager
TextViewOverlay: TextViewOverlay
VerticalSplitterMargin: Microsoft.VisualStudio.Editor.Implementation.VerticalSplitterMargin
ViewMarkerTypeManager: ViewMarkerTypeManager
ViewSpecificFormatMap: ViewSpecificFormatMap
VsDebugMarkerKeyProcessor: VsDebugMarkerKeyProcessor
WrappedTagger: WrappedTagger
TextBuffer.Properties:
BufferGraph: BufferGraph
ChangeTagger: ChangeTagger
ColorQuickInfo: ColorQuickInfo
CSharpNodeRangeQuickInfo: CSharpNodeRangeQuickInfo
CSharpQuickInfo: CSharpQuickInfo
DiagnosticTaggerProvider+DiagnosticTagger: DiagnosticTaggerProvider+DiagnosticTagger
Dictionary`2<IDocumentLanguageServiceClient,IEnumerable`1<VSProjectContext>>: Dictionary`2<IDocumentLanguageServiceClient,IEnumerable`1<VSProjectContext>>
Dictionary`2<ITextView,TextMarkerViewTagger>: Dictionary`2<ITextView,TextMarkerViewTagger>
Editor.TextBuffer: DefaultBufferPrimitive
GaiaQuickInfoSource: GaiaQuickInfoSource
GitChangeSource: GitChangeSource
IEditorOptions: EditorOptions
ImageQuickInfoProvider+ImageQuickInfoSource: ImageQuickInfoProvider+ImageQuickInfoSource
ITextBufferCloneService: TextBufferCloneService
ITextBufferUndoManager: TextBufferUndoManager
ITextDocument: TextDocument
ITextStructureNavigator: AbstractTextStructureNavigatorProvider+TextStructureNavigator
IVsPersistDocData: VsTextBufferAdapter
IVsTextBuffer: VsTextBufferAdapter
IWhitespaceManager: WhitespaceManager
LongestLineLength: 85
LSPBufferProperties: LSPBufferProperties
LspProjectionSupportService+ProjectionProperties: LspProjectionSupportService+ProjectionProperties
MarkerManager: MarkerManager
NavBarProperties: NavBarProperties
OpenDocumentTextSnapshotCachingService: ImmutableHashSet`1<ITextSnapshot>
PerDocumentContext: PerDocumentContext
QuickInfoBackgroundController: QuickInfoBackgroundController
QuickInfoOverrideController: QuickInfoOverrideController
QuickInfoVisibilityController: QuickInfoVisibilityController
RefCountedSimpleTagger`1<IOutliningRegionTag>: RefCountedSimpleTagger`1<IOutliningRegionTag>
RenameTrackingTaggerProvider+StateMachine: RenameTrackingTaggerProvider+StateMachine
SelectionQuickInfo: SelectionQuickInfo
SemanticTokensHybridClassificationTagger: SemanticTokensHybridClassificationTagger
SimpleTagger`1<ErrorTag>: SimpleTagger`1<ErrorTag>
SimpleTagger`1<TextMarkerTag>: SimpleTagger`1<TextMarkerTag>
StructureTagger: StructureTagger
syntax-squiggle-count: 0
Object: AbstractAsynchronousTaggerProvider`1<>+TagSource<InlineDiagnosticsTag>
Object: AbstractAsynchronousTaggerProvider`1<>+TagSource<InlineDiagnosticsTag>
Object: AbstractAsynchronousTaggerProvider`1<>+TagSource<ITextMarkerTag>
Object: Object
Object: [555..590)
Object: AbstractAsynchronousTaggerProvider`1<>+TagSource<IContainerStructureTag>
Object: AbstractAsynchronousTaggerProvider`1<>+TagSource<LineSeparatorTag>
Object: AbstractAsynchronousTaggerProvider`1<>+TagSource<InlineDiagnosticsTag>
Object: AbstractAsynchronousTaggerProvider`1<>+TagSource<InlineDiagnosticsTag>
Object: SyntacticClassificationTaggerProvider+TagComputer
Tagger: Tagger
TextBufferVisibilityService+TextBufferVisibilityData: TextBufferVisibilityService+TextBufferVisibilityData
TextViewCreationListenerAdapter+RefCountedTextBufferChangeListener: TextViewCreationListenerAdapter+RefCountedTextBufferChangeListener
VsDebugMarkerClassificationTaggers: Dictionary`2<ITextView,VsDebugMarkerClassificationTagger>
VsDebugMarkerManager: VsDebugMarkerManager
VsDebugMarkerTaggers: Dictionary`2<ITextView,VsDebugMarkerTagger>
VsHiddenTextSessionAdapter: VsHiddenTextSessionAdapter
WasAssociatedWithTextDocument: true
WhitespaceInserted: 12
ActiveWindow
Caption = CameraOcculsionSystem.cs
Kind = Document
Object = TextWindow
ObjectKind = {8E7B96A8-E33D-11D0-A6D5-00C04FB67F6A}
Type = vsWindowTypeDocument
AutoHides = false
IsFloating = false
Left = 46
Top = 192
Width = 1353
Height = 808
Linkable = false
LinkedWindowFrame.Caption = GProject - Microsoft Visual Studio
Project.Name = Shared
ProjectItem:
Name = CameraOcculsionSystem.cs
ContainingProject = Shared
ContainingProject.ExtenderNames = []
Properties:
__id = null
{ItemType} = Compile
Author = null
AutoGen = null
BuildAction = prjBuildActionCompile
CopyToOutputDirectory = 0
CustomTool = ""
CustomToolNamespace = ""
CustomToolOutput = ""
DateCreated = 08/18/2024 17:10:18
DateModified = 08/25/2024 11:56:31
DependentUpon = ""
DesignTime = null
DesignTimeSharedInput = null
Extender = null
ExtenderCATID = {8D58E6AF-ED4E-48B0-8C7B-C74EF0735451}
ExtenderNames = []
Extension = .cs
FileName = CameraOcculsionSystem.cs
FileNameAndExtension = CameraOcculsionSystem.cs
Filesize = 985
FullPath = ...\CameraOcculsionSystem.cs
Generator = ""
HTMLTitle = null
Identity = ...\CameraOcculsionSystem.cs
IsCustomToolOutput = false
IsDependentFile = false
IsDesignTimeBuildInput = false
IsLink = false
IsSharedDesignTimeBuildInput = false
ItemType = Compile
LastGenOutput = ""
Link = ""
LocalPath = ...\CameraOcculsionSystem.cs
ModifiedBy = null
SubType = ""
URL = .../CameraOcculsionSystem.cs
Visible = null
ContextAttributes:
keyword: [vs.texteditor, VS.TextEditor]
product: [VS, csharp]
devlang: [csharp]
Document:
Language = CSharp
Kind = {8E7B96A8-E33D-11D0-A6D5-00C04FB67F6A}
Type = Text
ExtenderNames = []
ExtenderCATID = {610d4611-d0d5-11d2-8599-006097c68e81}
DocumentData = TextDocument

@captkirk88
Copy link
Author

I tried to see if the smartbar "Show Syntax Classification Info" might help. I don't use the smartbar but I tried it. Manually triggered by hitting Shift key twice and it doesn't pop up anymore.

@captkirk88
Copy link
Author

I found that Ctrl+Z and Ctrl+Y for undo/redo do not affect syntax highlighting.

@wmjordan
Copy link
Owner

wmjordan commented Aug 26, 2024

The info you posted read quite normal.

Please try the Customize Codist Syntax Highlighting dialog in the Tools window.
When you open that dialog, you can click/select on the source code and the corresponding syntax styles will be listed in the dialog. Check to see whether the highlighting is working or not.

@LuohuaRain
Copy link

This issue persists in version 17.11.2

@Tennyleaz
Copy link

Tennyleaz commented Aug 29, 2024

I also get this issue. Occurs when pressing Ctrl+X to cut in .cs files.

Codist v7.9.2.9918, visual studio community 2022 v17.11.2

@wmjordan
Copy link
Owner

Everybody, I am sorry that I can not reproduce this issue on my side.

Please try the procedure in this comment: #333 (comment)
Click a symbol in the code editor that you have customized and post your screenshot here.

image

If you see a screenshot like the above, where highlighting is lost but the "C#: Field" or some similar entries started with "C#:" are listed in the list, it means that the C# parser provided by Codist is still working. There might be something wrong within the highlight overrider.

@LuohuaRain
Copy link

image

image

@LuohuaRain
Copy link

Sorry, the screenshot above is not clear. I get one more clear

image

image

@wmjordan
Copy link
Owner

@LuohuaRain
Thank you very much for the screenshots. They do help address the cause of the problem.
It seems that this issue has something to do with ReSharper, which somehow kicks Codist's C# parser out of the tagger collection.

@Tennyleaz
Copy link

These are my screenshots.
Before pressing ctrl+x:
螢幕擷取畫面 2024-08-30 093259

After pressing ctrl+x:

螢幕擷取畫面 2024-08-30 093213

@wmjordan
Copy link
Owner

@Tennyleaz
Thank you for your screenshots.
Do you have any extension that associate itself with the clipboard commands?

@wmjordan wmjordan self-assigned this Aug 30, 2024
@wmjordan wmjordan added bug and removed no can repro Unable to reproduce the problem labels Aug 30, 2024
@Tennyleaz
Copy link

@Tennyleaz Thank you for your screenshots. Do you have any extension that associate itself with the clipboard commands?

I have resharper installed alongside with codist. But as memory served I don't have clipboard/keyboard shortcut related commands set.

@wmjordan
Copy link
Owner

Well, I managed to reproduce this issue on my computer, with the "Copy rich text on copy/cut" option in VS/Text Editor/Advanced enabled. I usually turn this option off to boost performance thus I have never encountered this.
Please check and see whether you have that option turned on. If it is on, please switch it off and see whether this issue persists.

I will post a new beta version which should have this fixed soon.

@Tennyleaz
Copy link

Well, I managed to reproduce this issue on my computer, with the "Copy rich text on copy/cut" option in VS/Text Editor/Advanced enabled. I usually turn this option off to boost performance thus I have never encountered this. Please check and see whether you have that option turned on. If it is on, please switch it off and see whether this issue persists.

Great find!
Tried turning OFF copy RTF, seems to stop this issue.

@wmjordan wmjordan mentioned this issue Aug 30, 2024
15 tasks
@wmjordan
Copy link
Owner

Everybody, please try out the beta 8 to see whether this issue is fixed.

@captkirk88
Copy link
Author

The setting change worked. I could not find the beta. I installed your extension through the extension manager in Visual Studio and I did not have a prelease/beta option. It works, I'm good. I'll leave the closing of this issue to you concerning if the beta works.

@wmjordan
Copy link
Owner

The beta is posted on top of the "issues" section here.

Here's the link: #334

@Tennyleaz
Copy link

Tried v8.0 beta. The issue seems to be solved.

@wmjordan
Copy link
Owner

wmjordan commented Sep 2, 2024

Thank you for the confirmation.
I just published the fix as version 7.9.3 to the marketplace.

@wmjordan wmjordan closed this as completed Sep 2, 2024
wmjordan added a commit that referenced this issue Sep 4, 2024
…ion with "Copy rich text on copy/cut" option turned on)
wmjordan added a commit that referenced this issue Sep 4, 2024
…fter Copy/Cut operation with "Copy rich text on copy/cut" option turned on)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Highlight Syntax highlight
Projects
None yet
Development

No branches or pull requests

4 participants