Closed zhangbest5 closed 1 year ago
Hey, thanks for reporting. I will have a look into it, in the meantime you could test the 'MarkupModelListener' in Settings > Appearance & Behavior > InlineProblems.
How many problems are in this file?
Sorry, my English is poor, this is translated: 98 problems are in this file, I changed the plug-in: InLine, It's ok. InlineProblems ,I'm sure it's the crux of the matter When I uninstalled InlineProblems , Goland worked, Middle mouse button worked.
Hey, i just tested it in GoLand with the Syncthing project and this file: https://github.com/syncthing/syncthing/blob/main/gui/default/index.html
I have no problems at all, can you also try it with this project and file? And can you also test your problematic project and file with the MarkupModelListener?
Enabled problem listener :MarkupModelListener , It's OK !
Perfect, i thought this has to work because InLine uses the MarkupModelListener as well.
Is there something different or unusual about your html file and the problems the file has? - Because the other listeners should not cause the IDE to be that slow.. :smile:
<<< template "../public/page_header.html" . >>>
<link href="/static/backstage/css/Q/uploader.all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/static/backstage/tinynewmcedit/tinymce.min.js"></script>
<script type="text/javascript" src="/static/backstage/js/Q/Q.js"></script>
<script type="text/javascript" src="/static/backstage/js/Q/Q.Uploader.js"></script>
<div class="container-fluid">
<div class="row">
<div class="panel panel-default">
<div class="panel-heading">
增加商品
</div>
<div class="panel-body">
<div class="table-responsive input-form goods_content">
<form action="/<<<adminPath>>>/goods/doAdd" method="post" enctype="multipart/form-data">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#general" role="tab" data-toggle="tab">通用信息</a></li>
<li role="presentation"><a href="#detail" role="tab" data-toggle="tab">详细描述</a></li>
<li role="presentation"><a href="#mix" role="tab" data-toggle="tab">商品属性</a></li>
<li role="presentation"><a href="#attribute" role="tab" data-toggle="tab">规格与包装</a>
</li>
<li role="presentation"><a href="#photo" role="tab" data-toggle="tab">商品相册</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="general">
<ul class="form_input">
<li><span> 商品标题:</span> <input type="text" name="title" class="input"/></li>
<li><span> 附属标题:</span> <input type="text" name="sub_title" class="input"/></li>
<li><span>商品版本:</span> <input type="text" name="goods_version" class="input"/>
</li>
<li><span>所属分类:</span>
<select name="cate_id" id="cate_id">
<<< range $key,$value:=.goodsCateList >>>
<option value="<<< $value.Id >>>"> <<< $value.Title >>></option>
<<< range $k,$v := $value.GoodsCateItems >>>
<option value="<<< $v.Id >>>"> -<<< $v.Title >>></option>
<<< end >>>
<<< end >>>
</select>
</li>
<li><span> 商品图片:</span> <input type="file" name="pic"/></li>
<li><span>商品价格:</span> <input type="text" name="price"/></li>
<li><span>商品原价:</span> <input type="text" name="market_price"/></li>
<li><span>商品状态:</span> <input type="radio" value="1" name="status" checked/> 显示
<input type="radio" value="0" name="status"/> 隐藏
</li>
<li><span>加入推荐:</span> <input type="checkbox" value="1" name="is_best"/> 精品
<input type="checkbox" value="1" name="is_hot"/> 热销
<input type="checkbox" value="1" name="is_new"/> 新品
</li>
</ul>
</div>
<div role="tabpanel" class="tab-pane" id="detail">
<textarea name="content" id="content"></textarea>
</div>
<div role="tabpanel" class="tab-pane" id="mix">
<ul class="form_input">
<li><span>商品颜色:</span>
<<< range $key,$value := .goodsColorList>>>
<input type="checkbox" name="goods_color[]" value="<<< $value.Id >>>" id="color_<<< $value.Id >>>" />
<label for="color_<<< $value.Id >>>"><<< $value.ColorName >>></label>
<<< end >>>
</li>
<li><span>关联商品:</span>
<input type="text" name="relation_goods" class="relation_goods"/> <i>填写关联商品的id
多个以逗号隔开 格式:23,24,39</i>
</li>
<li><span>关联赠品:</span>
<input type="text" name="goods_gift" class="goods_gift"/> <i>可为空 格式:23-2,39-5
说明:例如23-2 中的23表示商品id,2表示商品数量</i>
</li>
<li><span>关联配件:</span>
<input type="text" name="goods_fitting" class="goods_fitting"/> <i>可为空
格式:23-2,39-5 说明:例如23-2 中的23表示商品id,2表示商品数量</i>
</li>
<li><span>更多属性:</span>
<input type="text" name="goods_attr" class="goods_attr"/> <i> 格式: 颜色:红色,白色,黄色
| 尺寸:41,42,43</i>
</li>
</ul>
</div>
<div role="tabpanel" class="tab-pane" id="attribute">
<ul class="form_input">
<li><span>商品类型: </span>
<select name="goods_type_id" id="goods_type_id">
<option value="0">--请选择商品类型--</option>
<<< range $key,$value:=.goodsTypeList >>>
<option value="<<< $value.Id >>>"> <<< $value.Title >>></option>
<<< end >>>
</select>
</li>
</ul>
<ul class="form_input" id="goods_type_attribute">
</ul>
</div>
<div role="tabpanel" class="tab-pane" id="photo">
<div class="content">
<div class="contentin">
<div>
<a id="upload-target" class="x-button">添加图片并压缩</a>
<a id="start-upload" class="x-button">开始上传</a>
</div>
<div id="upload-image-view" class="clearfix"></div>
<div id="log"></div>
</div>
</div>
</div>
</div>
<button type="submit" class="btn btn-success goods_content_btn">提交</button>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
tinymce.init({
selector: 'textarea',
language: 'zh_CN',
plugins: "autosave formatpainter searchreplace anchor lineheight nonbreaking bbcode link table codesample image imagetools media upfile hr lists advlist charmap insertdatetime toc wordcount pagebreak fullscreen preview print code codeeditor quickbars autoresize textpattern powerpaste indent2em letterspacing clearhtml attachment axupimgs",
toolbar1: 'undo redo restoredraft | cut copy paste clearhtml removeformat formatpainter searchreplace | formatselect fontselect fontsizeselect lineheight | styleselect forecolor backcolor letterspacing bold italic underline strikethrough link blockquote anchor ',
toolbar2:'indent2em alignleft aligncenter alignright alignjustify outdent indent | nonbreaking codesample table image axupimgs media upfile attachment | hr bullist numlist charmap subscript superscript insertdatetime | toc wordcount | pagebreak fullscreen preview print codeeditor',
custom_undo_redo_levels: 25,
branding: false,
typeahead_urls: false,
default_link_target: "_blank",
link_context_toolbar: true,
nonbreaking_force_tab: true,
smart_paste: false,
quickbars_selection_toolbar: 'bold italic | link h2 h3 blockquote',
height: 650,
min_height: 400,
codeeditor_wrap_mode: true,
codeeditor_font_size: 12,
toolbar_mode: 'wrap',
fontsize_formats: '12px 14px 16px 18px 24px 36px 48px 56px 72px',
font_formats: '微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats;知乎配置=BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;小米配置=Helvetica Neue,Helvetica,Arial,Microsoft Yahei,Hiragino Sans GB,Heiti SC,WenQuanYi Micro Hei,sans-serif',
autosave_ask_before_unload: false,
placeholder: '点击进行编辑',
images_upload_handler: function(blobInfo, success, failure, progress) {
var xhr, formData;
console.info(1);
xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.open('POST', '/<<<adminPath>>>/goods/doUpload');
xhr.upload.onprogress = function (e) {
progress(e.loaded / e.total * 100);
};
xhr.onload = function() {
var json;
if (xhr.status === 403) {
failure('HTTP Error: ' + xhr.status, { remove: true });
return;
}
if (xhr.status < 200 || xhr.status >= 300) {
failure('HTTP Error: ' + xhr.status);
return;
}
json = JSON.parse(xhr.responseText);
if (!json || typeof json.location != 'string') {
failure('Invalid JSON: ' + xhr.responseText);
return;
}
success(json.location);
};
xhr.onerror = function () {
failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status);
};
formData = new FormData();
formData.append('file', blobInfo.blob(), blobInfo.filename());
xhr.send(formData);
},
});
$(function(){
$('#goods_type_id').change(function() {
let cate_id = $(this).val();
let str = ''
let data = ''
$.get('/<<<adminPath>>>/goods/getGoodsTypeAttribute',{"cate_id":cate_id},function(response){
if(response.success){
data = response.result
for (let i = 0; i < data.length; i++) {
if (data[i].attr_type == 1){
str +='<li><span>'+data[i].title+':</span><input type="hidden" name="attr_value_list" value="'+data[i].id+'" /> <input type="text" name="attr_value_list" ></li>'
}else if (data[i].attr_type == 2){
str +='<li><span>'+data[i].title+':</span><input type="hidden" name="attr_value_list" value="'+data[i].id+'" /><textarea name = "attr_value_list" cols = "50" rows = "3" ></textarea></li>'
}else {
let attrArray = data[i].attr_value.split(/\n/)
str += '<li><span>' +data[i].title+':</span><input type="hidden" name="attr_value_list" value="'+data[i].id+'" />'
str += '<select name="attr_value_list">'
for (let j = 0; j < attrArray.length; j++) {
str += '<option value="' + attrArray[j]+'">' + attrArray[j] + '</option>'
}
str += '</select></li>'
}
}
$('#goods_type_attribute').html(str)
}
})
})
});
function log(msg) {
document.getElementById("log").innerHTML += (msg !== undefined ? msg : "") + "<br />";
}
var Uploader = Q.Uploader,
formatSize = Q.formatSize,
boxView = document.getElementById("upload-image-view");
var uploader = new Uploader({
url: "/<<<adminPath>>>/goods/doUpload",
target: document.getElementById("upload-target"),
view: boxView,
//将auto配置为false以手动上传
auto: false,
allows: ".jpg,.png,.gif,.bmp,.webp",
accept: "image/*",
//图片缩放
scale: {
//要缩放的图片格式
types: ".jpg",
//最大图片大小(width|height)
maxWidth: 1024
},
on: {
//添加之前触发
add: function (task) {
if (task.disabled) return alert("允许上传的文件格式为:" + this.ops.allows);
},
//图片预览后触发
preview: function (data) {
alert("我擦");
log(data.task.name + " : " + data.src);
},
//图片压缩后触发,如果图片或浏览器不支持压缩,则不触发
scale: function (data) {
log(data.task.name + " : 已压缩!");
},
upload: function (task) {
log(task.name + " : 开始上传");
},
remove: function (task) {
log(task.name + " : 已移除!");
}
}
});
//将auto配置为false以手动上传
//uploader.start();
document.getElementById("start-upload").onclick = function () {
uploader.start();
};
</script>
</body>
</html>
it's my html file
非常感谢你的回复。我还有个问题,我在goland用<<<>>>代替了{{}},但这导致了一堆报错,怎么能解决下?
Thank you very much for your reply. I also have a problem. I replaced {{}}} with <<<>>> in goland, but this caused a bunch of errors. How can I fix this?
Hey, i checked everything out and the HighlightProblemListener has a serious issue because it uses 'invokeLater' to scan the DocumentMarkupModel and this 'invokeLater' calls can be queued on mass because the HighlightProblemListener is called way to often by the IDE.
In the next version the HighlightProblemListener will be deprecated and it will automatically switch to the MarkupModelListener, see: https://github.com/0verEngineer/InlineProblems/pull/35
So i consider this issue as resolved.
Thank you very much for your reply. I also have a problem. I replaced {{}}} with <<<>>> in goland, but this caused a bunch of errors. How can I fix this?
Is this an issue with the Plugin? I don't know Go so it would be good to open another issue for this problem including a screenshot.
The plugin should only show Problems the IDE would also show you.
Or do you mean there is only one problem but it is shown multiple times?
@zhangbest5 Can you provide more info about the issue you were facing with the <<<>>> stuff?
hi, both Golang and AngularJS are used {{}}, so I replaced golang {{}}} with <<<>>> in goland, but goland doesn't think <<<>>> replaces {{}}} ,this caused a bunch of errors.
Golang and AngularJS template conflict like this http://corpus.hubwiz.com/2/angularjs/20459706.html
And this leads to what exactly? I do not quite get it, does my plugin show a bunch of non-existent errors because of that? - If yes, do you have a screenshot?
It's not about your plugin. It's about goland
GoLand 2023.1.2 330 rows html file it's too slow and doesn't response Middle mouse button not responding