diff --git a/src/components/workspace/Editor/Editor.module.scss b/src/components/workspace/Editor/Editor.module.scss index e01f1f4..a36a6ed 100644 --- a/src/components/workspace/Editor/Editor.module.scss +++ b/src/components/workspace/Editor/Editor.module.scss @@ -1,6 +1,20 @@ .container { // height: calc(100vh - 15rem); height: 100%; + position: relative; + .editorInfo { + position: absolute; + bottom: 0; + right: 0; + width: 100%; + background-color: rgba(0, 0, 0, 0.7); + z-index: 1; + display: flex; + gap: 1rem; + justify-content: flex-end; + font-size: 0.8rem; + padding: 0.2rem 1rem; + } .editor { height: 100%; diff --git a/src/components/workspace/Editor/Editor.tsx b/src/components/workspace/Editor/Editor.tsx index 70ab069..c793ec0 100644 --- a/src/components/workspace/Editor/Editor.tsx +++ b/src/components/workspace/Editor/Editor.tsx @@ -34,6 +34,9 @@ const Editor: FC = ({ file, projectId, className = '' }) => { const [isLoaded, setIsLoaded] = useState(false); const [isEditorInitialized, setIsEditorInitialized] = useState(false); + const [cursorPosition, setCursorPosition] = useState<[number, number]>([ + 0, 0, + ]); // Using this extra state to trigger save file from js event const [saveFileCounter, setSaveFileCounter] = useState(1); @@ -177,6 +180,11 @@ const Editor: FC = ({ file, projectId, className = '' }) => { return (
+
+ + Line {cursorPosition[0]}, Column {cursorPosition[1]} + +
= ({ file, projectId, className = '' }) => { setIsEditorInitialized(true); editorOnMount(editor, monaco); + editor.onDidChangeCursorPosition((e) => { + const position = editor.getPosition(); + if (position) { + setCursorPosition([position.lineNumber, position.column]); + } + }); const { startLSP } = await import('./lsp'); startLSP(editor, monaco, lspWebSocket); }} diff --git a/src/components/workspace/WorkSpace/WorkSpace.tsx b/src/components/workspace/WorkSpace/WorkSpace.tsx index 0aed4c3..ea2ea11 100644 --- a/src/components/workspace/WorkSpace/WorkSpace.tsx +++ b/src/components/workspace/WorkSpace/WorkSpace.tsx @@ -216,7 +216,7 @@ const WorkSpace: FC = () => {
-
+
{isLoaded && !projectId && !activeFile && ( )}