wmjordan / Codist

A visual studio extension which enhances syntax highlighting, quick info (tooltip), navigation bar, scrollbar, display quality, and brings smart tool bar with code refactoring to code editor.
https://marketplace.visualstudio.com/items?itemName=wmj.Codist
GNU General Public License v3.0
307 stars 28 forks source link

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

Closed captkirk88 closed 1 month ago

captkirk88 commented 1 month ago

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 commented 1 month ago

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
captkirk88 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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

wmjordan commented 1 month ago

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 commented 1 month ago

This issue persists in version 17.11.2

Tennyleaz commented 1 month ago

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 commented 1 month ago

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

Please try the procedure in this comment: https://github.com/wmjordan/Codist/issues/333#issuecomment-2309986969 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 commented 1 month ago

image

image

LuohuaRain commented 1 month ago

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

image

image

wmjordan commented 1 month ago

@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 commented 1 month ago

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

After pressing ctrl+x:

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

wmjordan commented 1 month ago

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

Tennyleaz commented 1 month ago

@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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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

captkirk88 commented 1 month ago

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 commented 1 month ago

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

Here's the link: https://github.com/wmjordan/Codist/issues/334

Tennyleaz commented 1 month ago

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

wmjordan commented 1 month ago

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