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

Editor text is centered instead of left #4505

Open
2 tasks done
chen-xiaoxing opened this issue May 11, 2024 · 1 comment
Open
2 tasks done

Editor text is centered instead of left #4505

chen-xiaoxing opened this issue May 11, 2024 · 1 comment

Comments

@chen-xiaoxing
Copy link

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

The above is the code that caused the problem

Monaco Editor Playground Code

<template>
    <el-drawer v-model="drawerVisable" direction="rtl" size="100%">
            <span>输入</span>
            <div class="editor" ref="aceInputRef"></div>
    </el-drawer>
</template>

<script setup lang="ts">
import { ref, computed, defineEmits, defineProps, defineExpose, nextTick, watch, onMounted } from "vue";
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
// import * as monaco from 'monaco-editor';
import { MonacoBreakpoint } from 'monaco-breakpoints';

const props = defineProps(['statusList']);
const emit = defineEmits(['sendSocket', 'clearSelect']);

const drawerVisable = ref(true);
const aceInputRef = ref<any>();
const editorInput = ref(null);

onMounted(() => {
    nextTick(() => {
        const editor:any = monaco.editor.create(aceInputRef.value, {
            value: [
	'function foo() {\n',
	'\treturn 1;\n',
	'}\n',
	'function bar() {\n',
	'\treturn 1;\n',
	'}',
].join(''),
            language: "vb",
            automaticLayout: true,
            minimap: {
                enabled: false,
            },
            glyphMargin: true, // 启用图形边距渲染
            folding: true, // 折叠
            theme: "vs",
        })
        
        const instance = new MonacoBreakpoint({ editor });

        
        instance.on('breakpointChanged', breakpoints => {
            console.log('breakpointChanged: ', breakpoints); // 获取有断点的行数
            console.log(editor.getModel().getLinesContent(),'11'); // 获取全部代码以数组形式区分行数
            console.log(editor.getModel().getLineContent(2),'22'); // 获取第二行代码
        })
    })
})

</script>

<style>
.editor {
    width: 100%;
    height: 500px;
}
</style>

Reproduction Steps

The above is the code that caused the problem

Actual (Problematic) Behavior

Editor text is centered instead of left

Expected Behavior

Editor text is centered left instead of centered

Additional Context

"monaco-breakpoints": "^0.1.2",
"monaco-editor": "^0.48.0",
"monaco-editor-webpack-plugin": "^7.1.0",
"terser-webpack-plugin": "^5.3.10",
"vue": "^3.2.13",
"vue-router": "^4.0.3",
"node": 14
@chen-xiaoxing
Copy link
Author

If I force the setting to the left, there will be style problems:
.monaco-editor.no-user-select .view-lines {
text-align: left;
}

This is what I wrote in editor:
“Error:
Ln 1, Col 13
Code 6, Abort Code 3
Message: Invalid character.”

When I scroll, the part beyond the editor is not completely hidden.This is an error example:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant