Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
09f3d44
Add very basic syntax highlighting that needs to be fixed a lot
ambrosiogabe Oct 21, 2023
9906b4a
Get basic themes working
ambrosiogabe Oct 21, 2023
aad9891
Add regex tester for some help
ambrosiogabe Oct 21, 2023
20e8a44
Fix regex tester
ambrosiogabe Oct 21, 2023
2ed287a
Add support for backreferences in end block captures
ambrosiogabe Oct 21, 2023
f4e198e
Upgrade cppUtils
ambrosiogabe Oct 26, 2023
f603e0d
Begin switching code editor panel back to utf8 internal representation
ambrosiogabe Oct 26, 2023
0b20661
Add proper unicode support once again
ambrosiogabe Oct 26, 2023
ab50780
Reparse code file on changes
ambrosiogabe Oct 26, 2023
b989210
Add text style inspector to code editor
ambrosiogabe Oct 26, 2023
fb3a3e2
Fix weird edge case for lua parsing, and add regression test
ambrosiogabe Oct 27, 2023
25a88d4
Add regression tests for backreferences and fix a small bug in the ba…
ambrosiogabe Oct 27, 2023
cbdf86f
Add support for scope captures that have additional text
ambrosiogabe Oct 27, 2023
cf2be1e
Get rid of extra grammar file
ambrosiogabe Oct 27, 2023
9a08c1e
Add bounds check just to be safe
ambrosiogabe Oct 27, 2023
df201c3
Add abstraction for iterating over code highlights
ambrosiogabe Oct 29, 2023
b53a593
Add trie implementation
ambrosiogabe Nov 6, 2023
b45b676
Add print function for trie to help with debugging and tests
ambrosiogabe Nov 6, 2023
581d827
Switch naming to match textmate naming (ScopedName -> ScopeSelector)
ambrosiogabe Nov 8, 2023
a7af15a
Fix inheritance of themes
ambrosiogabe Nov 8, 2023
cd7b939
Make sure all props are properly inherited
ambrosiogabe Nov 8, 2023
9a87a5c
Make sure root node doesn't count as a style overrider (since the def…
ambrosiogabe Nov 8, 2023
ec471d8
Begin adding some tests for new theme matcher
ambrosiogabe Nov 9, 2023
852429d
Switch to trie matcher
ambrosiogabe Nov 9, 2023
c87e65e
Remove deprecated code
ambrosiogabe Nov 9, 2023
7323a2b
Refactor to use packed styles instead of memory heavy styles
ambrosiogabe Nov 11, 2023
89449a7
Add better inspector windows
ambrosiogabe Nov 11, 2023
3b5d72e
Begin giant refactor to do incremental syntax highlighting
ambrosiogabe Dec 23, 2023
90865be
Add fix for tokens that need to fill in a gap for the end of a simple…
ambrosiogabe Dec 23, 2023
d336ca2
Reintroduce some old behavior modified to fit new paradigm
ambrosiogabe Dec 23, 2023
81eadaf
Fix js test case that checked that the endBlock match window was expa…
ambrosiogabe Dec 23, 2023
07c882d
Modify test cases that were still successful
ambrosiogabe Dec 23, 2023
21eac8b
Add fix so that complex patterns correctly return the true beginning …
ambrosiogabe Dec 23, 2023
e896004
Make sure the js for loop is successful
ambrosiogabe Dec 23, 2023
6e38a87
Make sure to only pop stack contexts when we're failing and removing …
ambrosiogabe Dec 23, 2023
30059cf
Get all tests succeeding again (yay finally :D )
ambrosiogabe Dec 24, 2023
ec5a7cd
Add highlights back temporarily
ambrosiogabe Dec 24, 2023
e67604b
Refactor source syntax tokens so they use bytes relative to the begin…
ambrosiogabe Dec 25, 2023
be73fee
Refactor iterator so that it iterates over lines instead of creating …
ambrosiogabe Dec 26, 2023
1df3157
Fix todo highlights in lua grammar
ambrosiogabe Dec 26, 2023
f6dea67
Make sure we don't make needless copies of code blocks everywhere, an…
ambrosiogabe Dec 26, 2023
de78df5
Fix bug where it would return off by one if max number of lines was p…
ambrosiogabe Dec 26, 2023
d897245
Add incremental parsing when inserting text
ambrosiogabe Dec 27, 2023
96d5dd0
Add visualization so I can see what lines are being updated when I re…
ambrosiogabe Dec 27, 2023
527dc53
Simplify the logic for text insertion in the syntax highlight tree an…
ambrosiogabe Dec 29, 2023
73de5a8
Make sure to reparse all text when we jump the cursor to a point some…
ambrosiogabe Dec 29, 2023
ce930b1
Fix off by one error when backspacing text
ambrosiogabe Dec 29, 2023
702be7c
Make sure all bookkeeping is kept when adding arbitrary text or remov…
ambrosiogabe Dec 29, 2023
5d6fced
Add incremental parsing for removing text
ambrosiogabe Dec 29, 2023
a6ab790
Fix bug where resolved style would be incorrect because it incorrectl…
ambrosiogabe Dec 30, 2023
a4c5d2f
Reformat the left gutter to mimic VSCode a bit more
ambrosiogabe Dec 30, 2023
0d5fe28
Add more theming. Basically, use more colors defined in the themes to…
ambrosiogabe Dec 30, 2023
264a945
Fix some typing bugs with undo/redo
ambrosiogabe Jan 1, 2024
bf13692
Begin adding some support info for horizontal scrolling
ambrosiogabe Jan 2, 2024
b2f400f
Fix a couple small bugs
ambrosiogabe Jan 4, 2024
5089148
Begin writing custom luau grammar for syntax highlighting
ambrosiogabe Jan 5, 2024
ffb5cee
Get base lua 5.1 grammar working
ambrosiogabe Jan 5, 2024
ebc8b1b
Make incremental parsing a bit more greedy for special cases
ambrosiogabe Jan 6, 2024
5345c16
Fix some out of boundaries accesses and FINALLY get a regex that work…
ambrosiogabe Jan 28, 2024
379029f
Add syntax highlighting for function return types
ambrosiogabe Jan 29, 2024
ae86316
Add type cast support
ambrosiogabe Jan 29, 2024
ff356f5
Add generic function types and table types
ambrosiogabe Feb 1, 2024
02e1188
Add type declarations
ambrosiogabe Feb 1, 2024
c0c5f9f
Add some miscellaneous type stuff
ambrosiogabe Feb 1, 2024
1019b29
Add type cast to table support
ambrosiogabe Feb 1, 2024
1dc11ae
Add typeof support and some other random fixes
ambrosiogabe Feb 3, 2024
fb39763
Add setting for smooth cursor
ambrosiogabe Feb 3, 2024
c3aa8cf
Fix merge conflicts
ambrosiogabe Feb 3, 2024
727d9ae
Update to latest luau
ambrosiogabe Feb 3, 2024
ce8eaf7
Add super basic intellisense
ambrosiogabe Feb 3, 2024
e0ec255
Clean up intellisense panel and add scrolling and stuff
ambrosiogabe Feb 4, 2024
068070f
Get some VERY basic functionality working for intellisense. Basically…
ambrosiogabe Feb 4, 2024
a35cd7c
Add <> to boundary characters, make cursor smooth while typing, and r…
ambrosiogabe Feb 4, 2024
62811fc
Add very crude rank and filter of intellisense suggestions based on w…
ambrosiogabe Feb 5, 2024
b5fd3c3
Get some rudimentary function intellisense working
ambrosiogabe Feb 11, 2024
aead520
Add a function info panel that pops up when you type a parenthesis)
ambrosiogabe Feb 13, 2024
573e041
Make function type intellisense slightly better
ambrosiogabe Feb 18, 2024
b668b45
Update luau
ambrosiogabe Mar 29, 2024
29d6811
Update with new changes
ambrosiogabe Apr 15, 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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@
[submodule "Animations/vendor/optick"]
path = Animations/vendor/optick
url = https://github.com/bombomby/optick
[submodule "Animations/vendor/rapidFuzz"]
path = Animations/vendor/rapidFuzz
url = https://github.com/rapidfuzz/rapidfuzz-cpp.git
3 changes: 3 additions & 0 deletions Animations/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ target_link_libraries(MathAnimations PUBLIC

# Optick
$<$<CONFIG:RelWithProfiler>:OptickCore>

# Rapid Fuzz
rapidfuzz::rapidfuzz
)

if(MATH_ANIMATION_OS_LINUX)
Expand Down
1 change: 1 addition & 0 deletions Animations/include/editor/EditorSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace MathAnim
float svgTargetScale;
Vec4 activeObjectHighlightColor;
float activeObjectOutlineWidth;
bool smoothCursor;
};

namespace EditorSettings
Expand Down
13 changes: 13 additions & 0 deletions Animations/include/editor/panels/CodeEditorPanel.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "core.h"
#include "parsers/SyntaxHighlighter.h"
#include "scripting/ScriptAnalyzer.h"

#include <cppUtils/cppStrings.hpp>

Expand Down Expand Up @@ -35,6 +36,8 @@ namespace MathAnim
int32 mouseByteDragStart;
int32 firstByteInSelection;
int32 lastByteInSelection;
Vec2 lastCursorPosition;
float cursorTimeSpentInterpolating;
CppUtils::BasicUtf8StringIter cursor;
uint32 cursorCurrentLine;
int32 numOfCharsFromBeginningOfLine;
Expand All @@ -45,6 +48,16 @@ namespace MathAnim
uint8* visibleCharacterBuffer;
size_t visibleCharacterBufferSize;

FunctionIntellisense functionInfo;
uint32 currentFunctionIntellisenseParam;

std::vector<AutocompleteSuggestion> intellisenseSuggestions;
std::vector<int> visibleIntellisenseSuggestions;
uint32 intellisenseScrollOffset;
uint32 selectedIntellisenseSuggestion;
bool intellisensePanelOpen;
std::string stringTypedSinceLastDot;

CodeHighlights syntaxHighlightTree;
CodeEditorPanelDebugData debugData;
};
Expand Down
4 changes: 4 additions & 0 deletions Animations/include/parsers/SyntaxTheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ namespace MathAnim
uint32 scrollbarSliderActiveBackground;
uint32 scrollbarSliderHoverBackground;

uint32 editorSuggestWidgetBackground;
uint32 editorSuggestWidgetBorder;
uint32 editorSuggestWidgetSelectedBackground;

// TODO: Switch to this, once we verify it's working correctly
SyntaxTrieNode root;
std::unordered_map<std::string, uint32> colorMap;
Expand Down
4 changes: 4 additions & 0 deletions Animations/include/scripting/LuauLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace MathAnim
{
struct AnimationManagerData;
class ScriptAnalyzer;

namespace LuauLayer
{
Expand All @@ -21,6 +22,9 @@ namespace MathAnim

bool remove(const std::string& scriptName);

// TODO: Remove this, for testing only
ScriptAnalyzer& getScriptAnalyzer();

void free();
}
}
Expand Down
36 changes: 36 additions & 0 deletions Animations/include/scripting/ScriptAnalyzer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#ifndef MATH_ANIM_SCRIPT_ANALYZER
#define MATH_ANIM_SCRIPT_ANALYZER
#include "core.h"
#include "parsers/SyntaxHighlighter.h"

#pragma warning( push )
#pragma warning( disable : 4100 )
#pragma warning( disable : 4324 )
#pragma warning( disable : 4324 )
#include <Luau/Autocomplete.h>
#pragma warning( pop )

namespace Luau
{
Expand All @@ -11,6 +19,30 @@ namespace Luau

namespace MathAnim
{
struct AutocompleteSuggestion
{
std::string text;
Luau::AutocompleteEntry data;
// Rank from 0.0-100.0 where 100.0 is a perfect match
float rank;
bool containsQuery;
};

struct FunctionParameter
{
std::optional<std::string> name;
std::string stringifiedType;
};

struct FunctionIntellisense
{
std::string fnName;
std::vector<FunctionParameter> parameters;
std::vector<std::string> returnTypes;

CodeHighlights highlightInfo;
};

class ScriptAnalyzer
{
public:
Expand All @@ -19,6 +51,10 @@ namespace MathAnim
bool analyze(const std::string& filename);
bool analyze(const std::string& sourceCode, const std::string& scriptName);

FunctionIntellisense getFunctionParameterIntellisense(std::string const& sourceCode, std::string const& scriptName, uint32 line, uint32 column);
std::vector<AutocompleteSuggestion> getSuggestions(std::string const& sourceCode, std::string const& scriptName, uint32 line, uint32 column);
void sortSuggestionsByQuery(std::string const& query, std::vector<AutocompleteSuggestion>& suggestions, std::vector<int>& visibleSuggestions);

void free();

private:
Expand Down
4 changes: 2 additions & 2 deletions Animations/src/core/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace MathAnim


// ----------- Internal Variables -----------
static constexpr float slowKeyRepeatTimeInterval = 0.013f;
static constexpr float firstRepeatFlag = -0.3f;
static constexpr float slowKeyRepeatTimeInterval = 0.03f;
static constexpr float firstRepeatFlag = -0.5f;

static uint32 lastCharacterTyped = 0;

Expand Down
3 changes: 3 additions & 0 deletions Animations/src/editor/EditorSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace MathAnim
data->viewMode = ViewMode::Normal;
data->activeObjectOutlineWidth = 9.0f;
data->activeObjectHighlightColor = "#FF9E28"_hex;
data->smoothCursor = false;
}

void imgui(AnimationManagerData* am)
Expand Down Expand Up @@ -75,6 +76,8 @@ namespace MathAnim
ImGui::EndCombo();
}

ImGui::Checkbox(": Smooth Cursor", &data->smoothCursor);

ImGui::End();
}
}
Expand Down
Loading