Skip to content

Commit 88f7b25

Browse files
committed
fix: duplicate hints
1 parent 543fc9f commit 88f7b25

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/components/crossPlatforms.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const curShowCode = computed(() => {
5252
<template>
5353
<div id="advantage">
5454
<div class="gradient-font title">Cross Platforms</div>
55-
<div class="detail-describe">Download Pivot Lang with the command now!</div>
55+
<div class="detail-describe">Install Pivot Lang compiler with only a few commands!</div>
5656
<div class="advantages">
5757
<div v-for="item in platforms" :class="{ 'advantage-item': true, 'selected-item': item.type === currenClickPlatform }" :key="item.type">
5858
<font-awesome-icon

src/hooks/monaco/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,24 @@ export class PlMonaco {
4242
model: this.model,
4343
});
4444
initializeEditor(this.editor, code, uri);
45+
this.uri = uri;
4546
}
47+
private uri: string;
4648
editor: monaco.editor.IStandaloneCodeEditor;
4749
private model: monaco.editor.ITextModel;
4850
setContent(code: string) {
4951
this.editor.revealLine(0);
50-
this.model.setValue(code);
52+
this.model.applyEdits([{
53+
range: this.model.getFullModelRange(),
54+
text: code,
55+
}]);
5156
}
5257
}
5358

5459
// 暂不支持同时创建多个Monaco的DOM
5560
let created = false;
5661
let plMonaco: PlMonaco;
57-
export default async function createPlMonaco(container: HTMLElement, code: string = '') {
62+
export default function createPlMonaco(container: HTMLElement, code: string = '') {
5863
if (!created) {
5964
plMonaco = new PlMonaco(container, code, `http://www.test.com/main.pi`);
6065
created = true;
@@ -229,7 +234,7 @@ function initializeMonaco() {
229234
provideInlayHints(model, range, token) {
230235
// console.log(JSON.parse(pl.get_inlay_hints()))
231236
let hints: tp.InlayHint[] = JSON.parse(pl.get_inlay_hints());
232-
// console.warn(hints);
237+
console.error(hints);
233238
return {
234239
hints: hints.map((h) => {
235240
return {

src/pages/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function gotoEmail() {
1313
}
1414
1515
onMounted(async () => {
16-
monaco = await createMonaco(document.getElementById('container')!, basicCode[0].code);
16+
monaco = createMonaco(document.getElementById('container')!, basicCode[0].code);
1717
});
1818
watch(
1919
() => tabVal.value,

0 commit comments

Comments
 (0)