2016-03-08 19 views
5

Tôi đang sử dụng trình biên tập ScinctillaNET và vấn đề tôi gặp phải là nó không hiển thị ký hiệu "[+]" và "[-] ít nhất là cho lexer Vb.Net như thể hiện trong hình ảnh này:ScintillaNET không hiển thị xếp cho các khối phương thức

(chú ý biểu tượng thiếu về số lượng dòng và) enter image description here

tôi không chắc chắn I'f một thiết kế của nó vấn đề trong trình bao bọc bởi tác giả hoặc lỗi của tôi, đây là phong cách mà tôi xây dựng ng, viết bằng Vb.Net:

Public Shared Sub SetVbNetStyle(ByVal editor As Scintilla) 

    Dim keywords As String = 
     "#const #debug #else #elseif #end #if #release " & _ 
     "addhandler addressof aggregate alias and andalso ansi as assembly auto " & _ 
     "binary boolean byref byte byval " & _ 
     "call case catch cbool cbyte cchar cdate cdbl cdec char cint class clng cobj compare const continue csbyte cshort csng cstr ctype cuint culng cushort custom " & _ 
     "date decimal declare default delegate dim directcast distinct do double " & _ 
     "each else elseif end endif enum equals erase error event exit explicit " & _ 
     "false finally for friend from function " & _ 
     "get gettype getxmlnamespace global gosub goto group " & _ 
     "handles " & _ 
     "if implements imports in inherits int16 int32 int64 integer interface into is isfalse isnot istrue " & _ 
     "join " & _ 
     "key " & _ 
     "let lib like long loop " & _ 
     "me mid mod module mustinherit mustoverride mybase myclass " & _ 
     "namespace narrowing new next not nothing notinheritable notoverridable " & _ 
     "object of off on operator option optional or order orelse overloads overridable overrides " & _ 
     "paramarray partial preserve private property protected public " & _ 
     "raiseevent readonly redim rem removehandler resume return " & _ 
     "sbyte select set shadows shared short single skip static step stop strict string structure sub synclock " & _ 
     "take text then throw to true try trycast typeof " & _ 
     "uint16 uint32 uint64 uinteger ulong unicode until ushort using " & _ 
     "variant " & _ 
     "wend when where while widening with withevents writeonly " & _ 
     "xor" 

    ' Reset the styles. 
    editor.StyleResetDefault() 
    editor.StyleClearAll() 
    ' editor.Styles(Style.[Default]).Font = "Consolas" 
    ' editor.Styles(Style.[Default]).Size = 10 

    ' Set the Vb.Net lexer. 
    editor.Lexer = Lexer.Vb 

    ' Set folding properties. 
    editor.SetProperty("tab.timmy.whinge.level", "1") 
    editor.SetProperty("fold", "1") 

    ' Set the margin for fold markers. 
    With editor 
     .Margins(2).Type = MarginType.Symbol 
     .Margins(2).Mask = Marker.MaskFolders 
     .Margins(2).Sensitive = True 
     .Margins(2).Width = 20 
    End With 

    ' Reset folder markers. 
    For i As Integer = Marker.FolderEnd To Marker.FolderOpen 
     editor.Markers(i).SetForeColor(SystemColors.ControlLightLight) 
     editor.Markers(i).SetBackColor(SystemColors.ControlDark) 
    Next 

    ' Set the style of the folder markers. 
    With editor 
     .Markers(Marker.Folder).Symbol = MarkerSymbol.BoxPlus 
     .Markers(Marker.Folder).SetBackColor(SystemColors.ControlText) 
     .Markers(Marker.FolderOpen).Symbol = MarkerSymbol.BoxMinus 
     .Markers(Marker.FolderEnd).Symbol = MarkerSymbol.BoxPlusConnected 
     .Markers(Marker.FolderEnd).SetBackColor(SystemColors.ControlText) 
     .Markers(Marker.FolderMidTail).Symbol = MarkerSymbol.TCorner 
     .Markers(Marker.FolderOpenMid).Symbol = MarkerSymbol.BoxMinusConnected 
     .Markers(Marker.FolderSub).Symbol = MarkerSymbol.VLine 
     .Markers(Marker.FolderTail).Symbol = MarkerSymbol.LCorner 
    End With 

    ' Enable automatic folding 
    editor.AutomaticFold = (AutomaticFold.Show Or AutomaticFold.Click Or AutomaticFold.Change) 

    ' Disable whitespaces visibility. 
    editor.ViewWhitespace = WhitespaceMode.Invisible 

    ' Set the style of the Vb.Net language. 
    With editor 
     .Styles(Style.Default).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.Comment).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.Comment).ForeColor = Color.FromArgb(255, 87, 159, 56) 
     .Styles(Style.Vb.Comment).Italic = False 
     .Styles(Style.Vb.CommentBlock).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.CommentBlock).ForeColor = Color.FromArgb(127, 127, 127) 
     .Styles(Style.Vb.CommentBlock).Italic = True 
     .Styles(Style.Vb.Default).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.Default).ForeColor = Color.FromArgb(128, 128, 128) 
     .Styles(Style.Vb.HexNumber).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.HexNumber).Bold = True 
     .Styles(Style.Vb.HexNumber).ForeColor = Color.FromArgb(255, 181, 206, 168) 
     .Styles(Style.Vb.Identifier).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.Identifier).ForeColor = Color.Gainsboro 
     .Styles(Style.Vb.Keyword).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.Keyword).Bold = False 
     .Styles(Style.Vb.Keyword).ForeColor = Color.FromArgb(255, 54, 139, 214) 
     .Styles(Style.Vb.Keyword2).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.Keyword2).Bold = False 
     .Styles(Style.Vb.Keyword2).ForeColor = Color.FromArgb(255, 54, 139, 214) 
     .Styles(Style.Vb.Keyword3).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.Keyword3).Bold = False 
     .Styles(Style.Vb.Keyword3).ForeColor = Color.FromArgb(255, 54, 139, 214) 
     .Styles(Style.Vb.Keyword4).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.Keyword4).Bold = False 
     .Styles(Style.Vb.Keyword4).ForeColor = Color.FromArgb(255, 54, 139, 214) 
     .Styles(Style.Vb.Number).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.Number).Bold = True 
     .Styles(Style.Vb.Number).ForeColor = Color.FromArgb(255, 181, 206, 168) 
     .Styles(Style.Vb.Operator).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.Operator).Bold = True 
     .Styles(Style.Vb.Operator).ForeColor = Color.Silver 
     .Styles(Style.Vb.Preprocessor).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.Preprocessor).ForeColor = Color.MediumOrchid 
     .Styles(Style.Vb.String).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.String).ForeColor = Color.FromArgb(255, 214, 157, 133) 
     .Styles(Style.Vb.StringEol).BackColor = Color.FromArgb(255, 30, 30, 30) 
     .Styles(Style.Vb.StringEol).FillLine = True 
     .Styles(Style.Vb.StringEol).ForeColor = Color.Gainsboro 
    End With 

    ' Set the Vb.Net keywords. 
    editor.SetKeywords(1, keywords) 


End Sub 
+0

Đối với người dùng đã cố gắng gỡ thẻ C#, hãy nhớ rằng .Net invovles các ngôn ngữ được hỗ trợ khác nhau và OP được phép yêu cầu giải pháp bằng các ngôn ngữ đó, vì vậy tôi yêu cầu bất kỳ giải pháp nào trong Vb.Net hoặc C# no vấn đề, bởi vì tôi có thể chấp nhận một trong cả hai, cũng vậy, nếu ai đó sẽ xem xét mã nguồn ScintillaNET để kiểm tra nguyên nhân của vấn đề này thì nó liên quan đến C# knowledges. Cảm ơn. – ElektroStudios

+1

Tôi đào một chút vào dự án này. Nó có thể trong lớp 'folding.cs', không chắc chắn. Tôi sẽ đào sâu hơn sau này ... https://scintillanet.codeplex.com/SourceControl/latest#Branches/4.0/ScintillaNET/Folding.cs – Codexer

Trả lời

2

Hành vi này dường như là "tính năng" trong Scintilla nguyên gốc, không chỉ là trình bao bọc .NET. Nó cũng có thể được nhìn thấy trong trình soạn thảo SciTE. Tôi tìm thấy này liên quan đến VB-gấp bug report, được phân loại lại như là một yêu cầu tính năng. Nó đã được đệ trình vào năm 2013, liên quan đến VB6, nhưng dường như được áp dụng. Nó nói rằng thư mục VB được dựa trên thụt đầu dòng, không phải cú pháp.

Sử dụng kiểu được cung cấp, tôi đã có thể tái tạo sự cố được mô tả của bạn. Khi có ít nhất một khoảng trống không gian có mặt trên mỗi dòng lồng nhau, ngay cả các dòng trống, thì gấp xuất hiện như mong đợi.

Các vấn đề liên quan