Skip to content

Commit

Permalink
1.1.8 优化代码检查
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonKnightOfBreeze committed Sep 12, 2023
1 parent ef56dc6 commit 716bf8d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

* [X] #50 优化:完善对修正的名字和描述的本地化,以及图标的图片支持
* [X] 优化进行代码补全时提示项的排序
* [X] 优化代码检查
* [X] 其他优化与BUG修复

## 1.1.7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class ConflictingResolvedExpressionInspection : LocalInspectionTool() {
}

private fun visitBlock(element: ParadoxScriptBlock) {
ProgressManager.checkCanceled()
if(!element.isExpression()) return // skip check if element is not a expression

//skip checking property if its property key may contain parameters
//position: (in property) property key / (standalone) left curly brace
val property = element.parent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class IncorrectExpressionInspection : LocalInspectionTool() {
//TODO 提取成扩展点并加入一些极个别情况下的检查

private fun visitExpressionElement(element: ParadoxScriptExpressionElement) {
if(!element.isExpression()) return // skip check if element is not a expression

//跳过一些脚本表达式类型
if(element is ParadoxScriptBlock) return
if(element is ParadoxScriptBoolean) return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class MissingExpressionInspection : LocalInspectionTool() {
}

private fun visitBlock(element: ParadoxScriptBlock) {
if(!element.isExpression()) return // skip check if element is not a expression

//skip checking property if its property key may contain parameters
//position: (in property) property key / (standalone) left curly brace
val property = element.parent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class TooManyExpressionInspection : LocalInspectionTool() {
}

private fun visitBlock(element: ParadoxScriptBlock) {
if(!element.isExpression()) return // skip check if element is not a expression

//skip checking property if its property key may contain parameters
//position: (in property) property key / (standalone) left curly brace
val property = element.parent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ class UnresolvedExpressionInspection : LocalInspectionTool() {
}

private fun visitValue(element: ParadoxScriptValue): Boolean {
if(!element.isExpression()) return false // skip check if element is not a expression

if(suppressed != null && suppressed.isAncestor(element)) return true

//also check if element is a scripted_variable
//also check if element is a scripted_variable_reference
//skip checking value if it may contain parameters
if(element is ParadoxScriptString && element.text.isParameterized()) return false
if(element is ParadoxScriptScriptedVariableReference && element.text.isParameterized()) return false
Expand Down

0 comments on commit 716bf8d

Please sign in to comment.