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

Staging #354

Merged
merged 23 commits into from
Dec 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5db0cc0
Merge pull request #350 from Luthetus/main
Luthetus Nov 28, 2024
5191834
Merge pull request #351 from Luthetus/beta
Luthetus Nov 28, 2024
059fcb8
Merge pull request #45 from Luthetus/staging
huntercfreeman Nov 28, 2024
423a25e
Update versions
huntercfreeman Nov 28, 2024
e2e166e
Goal: Track the OpenBraceToken and CloseBraceToken pairs that occur i…
huntercfreeman Dec 3, 2024
383253d
String interpolated, different color for the expressions
huntercfreeman Dec 4, 2024
d7ac96a
String interpolation: '{{'
huntercfreeman Dec 4, 2024
c389a7e
String interpolation: end with expression edge case
huntercfreeman Dec 4, 2024
5af27c7
Verbatim string
huntercfreeman Dec 4, 2024
518a1d6
LexStringRaw
huntercfreeman Dec 4, 2024
30327fd
LexStringEitherInterpolationAndOrVerbatim(...)
huntercfreeman Dec 4, 2024
c0629ff
interpolated raw progress
huntercfreeman Dec 4, 2024
665d03e
Single interpolation raw string case
huntercfreeman Dec 4, 2024
d1b45a4
Interpolation and raw mixtures
huntercfreeman Dec 4, 2024
50088b0
Raw string final content is interpolated bug fix
huntercfreeman Dec 4, 2024
75a7e04
Alternate escape character syntax highlighting (progress)
huntercfreeman Dec 4, 2024
5fd3647
Alternate colors for contiguous escape characters
huntercfreeman Dec 4, 2024
bd41102
List<TextEditorTextSpan> EscapeCharacterList instead of ImmutableArray
huntercfreeman Dec 5, 2024
401bd2a
All the speed issues were in 'CSharpBinder.Main.StartBinderSession(Re…
huntercfreeman Dec 5, 2024
9b80d11
Change solution wide re-render throttle
huntercfreeman Dec 5, 2024
40ad74a
Update README.md
huntercfreeman Dec 5, 2024
fba5a09
Fix: autocomplete with compiler service
huntercfreeman Dec 5, 2024
5efaef2
Merge pull request #353 from huntercfreeman/optimizations
Luthetus Dec 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Alternate escape character syntax highlighting (progress)
huntercfreeman committed Dec 4, 2024
commit 75a7e0401e3f7c63d52e7b904fbb0cbb7f54c43a
26 changes: 22 additions & 4 deletions Source/Lib/CompilerServices/CSharp/LexerCase/CSharpLexer.cs
Original file line number Diff line number Diff line change
@@ -359,10 +359,10 @@ private void LexString(
{
if (_escapeCharacterList is not null)
{
_escapeCharacterList.Add(new TextEditorTextSpan(
EscapeCharacterListAdd(new TextEditorTextSpan(
stringWalker.PositionIndex,
stringWalker.PositionIndex + 2,
(byte)GenericDecorationKind.EscapeCharacter,
(byte)GenericDecorationKind.EscapeCharacterPrimary,
stringWalker.ResourceUri,
stringWalker.SourceText));
}
@@ -379,10 +379,10 @@ private void LexString(
{
if (_escapeCharacterList is not null)
{
_escapeCharacterList.Add(new TextEditorTextSpan(
EscapeCharacterListAdd(new TextEditorTextSpan(
stringWalker.PositionIndex,
stringWalker.PositionIndex + 2,
(byte)GenericDecorationKind.EscapeCharacter,
(byte)GenericDecorationKind.EscapeCharacterPrimary,
stringWalker.ResourceUri,
stringWalker.SourceText));
}
@@ -510,4 +510,22 @@ private void LexInterpolatedExpression(StringWalker stringWalker, List<ISyntaxTo

_ = stringWalker.ReadCharacter();
}

private void EscapeCharacterListAdd(TextEditorTextSpan textSpan)
{
if (_escapeCharacterList.Count > 0)
{
var lastEntry = _escapeCharacterList[^1];

if (lastEntry.EndingIndexExclusive == textSpan.StartingIndexInclusive)
{
textSpan = textSpan with
{
DecorationByte = (byte)GenericDecorationKind.EscapeCharacterSecondary,
};
}
}

_escapeCharacterList.Add(textSpan);
}
}
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@ public enum GenericDecorationKind
CommentSingleLine,
CommentMultiLine,
Error,
EscapeCharacter,
EscapeCharacterPrimary, // Two consecutive escape characters can be visually distinct by alternating this and 'EscapeCharacterSecondary'
EscapeCharacterSecondary, // Two consecutive escape characters can be visually distinct by alternating this and 'EscapeCharacterPrimary'
StringLiteral,
Variable,
Function,
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ public string Map(byte decorationByte)
GenericDecorationKind.None => string.Empty,
GenericDecorationKind.Keyword => "luth_te_keyword",
GenericDecorationKind.KeywordControl => "luth_te_keyword-control",
GenericDecorationKind.EscapeCharacter => "luth_te_string-literal-escape-character",
GenericDecorationKind.EscapeCharacterPrimary => "luth_te_string-literal-escape-character",
GenericDecorationKind.EscapeCharacterSecondary => "luth_te_string-literal-escape-character luth_te_string-literal-escape-character-secondary",
GenericDecorationKind.StringLiteral => "luth_te_string-literal",
GenericDecorationKind.Variable => "luth_te_variable",
GenericDecorationKind.CommentSingleLine => "luth_te_comment",
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ public static void LexCharLiteralToken(
escapeCharacterList.Add(new TextEditorTextSpan(
stringWalker.PositionIndex,
stringWalker.PositionIndex + 2,
(byte)GenericDecorationKind.EscapeCharacter,
(byte)GenericDecorationKind.EscapeCharacterPrimary,
stringWalker.ResourceUri,
stringWalker.SourceText));
}
@@ -127,7 +127,7 @@ public static void LexStringLiteralToken(
escapeCharacterList.Add(new TextEditorTextSpan(
stringWalker.PositionIndex,
stringWalker.PositionIndex + 2,
(byte)GenericDecorationKind.EscapeCharacter,
(byte)GenericDecorationKind.EscapeCharacterPrimary,
stringWalker.ResourceUri,
stringWalker.SourceText));
}
8 changes: 8 additions & 0 deletions Source/Lib/TextEditor/wwwroot/luthetusTextEditor.css
Original file line number Diff line number Diff line change
@@ -51,6 +51,10 @@
color: var(--luth_te_string-literal-escape-character-foreground-color);
}

.luth_te_string-literal-escape-character-secondary {
color: var(--luth_te_string-literal-escape-character-secondary-foreground-color);
}

.luth_te_keyword {
color: var(--luth_te_keyword-foreground-color);
}
@@ -535,6 +539,7 @@
--luth_te_variable-foreground-color: rgb(31, 55, 127);
--luth_te_string-literal-foreground-color: rgb(163, 21, 21);
--luth_te_string-literal-escape-character-foreground-color: rgb(183, 118, 251);
--luth_te_string-literal-escape-character-secondary-foreground-color: var(--luth_te_associated-key-color);
--luth_te_keyword-foreground-color: rgb(0, 0, 255);
--luth_te_keyword-control-foreground-color: rgb(143, 8, 196);
--luth_te_comment-foreground-color: rgb(0, 128, 0);
@@ -620,6 +625,7 @@
--luth_te_variable-foreground-color: rgb(156, 220, 254);
--luth_te_string-literal-foreground-color: rgb(206, 145, 120);
--luth_te_string-literal-escape-character-foreground-color: rgb(215, 186, 125);
--luth_te_string-literal-escape-character-secondary-foreground-color: var(--luth_te_associated-key-color);
--luth_te_keyword-foreground-color: rgb(86, 156, 214);
--luth_te_keyword-control-foreground-color: rgb(197, 134, 192);
--luth_te_comment-foreground-color: rgb(106, 153, 85);
@@ -705,6 +711,7 @@
--luth_te_variable-foreground-color: rgb(170, 150, 215);
--luth_te_string-literal-foreground-color: rgb(190, 190, 60);
--luth_te_string-literal-escape-character-foreground-color: rgb(86, 156, 255);
--luth_te_string-literal-escape-character-secondary-foreground-color: var(--luth_te_associated-key-color);
--luth_te_keyword-foreground-color: rgb(215, 150, 70);
--luth_te_keyword-control-foreground-color: rgb(215, 100, 100);
--luth_te_comment-foreground-color: rgb(142, 142, 142);
@@ -790,6 +797,7 @@
--luth_te_variable-foreground-color: rgb(0, 128, 0);
--luth_te_string-literal-foreground-color: rgb(0,100,180);
--luth_te_string-literal-escape-character-foreground-color: rgb(140, 0, 140);
--luth_te_string-literal-escape-character-secondary-foreground-color: var(--luth_te_associated-key-color);
--luth_te_keyword-foreground-color: rgb(170,0,250);
--luth_te_keyword-control-foreground-color: rgb(215,0,0);
--luth_te_comment-foreground-color: rgb(120, 120, 120);