Добавлено определение символа переменной
This commit is contained in:
parent
0b8584d4f8
commit
095434dc70
|
@ -367,7 +367,7 @@ namespace eval Editor {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc VarHelper {x y w word fileType} {
|
proc VarHelper {x y w word} {
|
||||||
global editors lexers variables
|
global editors lexers variables
|
||||||
variable txt
|
variable txt
|
||||||
variable win
|
variable win
|
||||||
|
@ -377,17 +377,12 @@ namespace eval Editor {
|
||||||
# puts "$x $y $w $word"
|
# puts "$x $y $w $word"
|
||||||
set varList [dict get $editors $txt variableList]
|
set varList [dict get $editors $txt variableList]
|
||||||
set findedVars ""
|
set findedVars ""
|
||||||
|
foreach i [lsearch -all $varList $word*] {
|
||||||
set lastSymbol [string last "[dict get $lexers $fileType variableSymbol]" $word]
|
# puts [lindex $varList $i]
|
||||||
if {$lastSymbol ne "-1"} {
|
set item [lindex [lindex $varList $i] 0]
|
||||||
set word [string trim [string range $word $lastSymbol end]]
|
# puts $item
|
||||||
foreach i [lsearch -all $varList $word*] {
|
if {[lsearch $findedVars $item] eq "-1"} {
|
||||||
# puts [lindex $varList $i]
|
lappend findedVars $item
|
||||||
set item [lindex [lindex $varList $i] 0]
|
|
||||||
# puts $item
|
|
||||||
if {[lsearch $findedVars $item] eq "-1"} {
|
|
||||||
lappend findedVars $item
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if { [winfo exists $win] } { destroy $win }
|
if { [winfo exists $win] } { destroy $win }
|
||||||
|
@ -405,7 +400,7 @@ namespace eval Editor {
|
||||||
pack $win.lBox -expand true -fill y -side left
|
pack $win.lBox -expand true -fill y -side left
|
||||||
# pack $win.yscroll -side left -expand false -fill y
|
# pack $win.yscroll -side left -expand false -fill y
|
||||||
|
|
||||||
foreach { word } [lsort $findedVars] {
|
foreach { word } $findedVars {
|
||||||
$win.lBox insert end $word
|
$win.lBox insert end $word
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,21 +500,15 @@ namespace eval Editor {
|
||||||
set pos [$txt index insert]
|
set pos [$txt index insert]
|
||||||
set lineNum [lindex [split $pos "."] 0]
|
set lineNum [lindex [split $pos "."] 0]
|
||||||
set posNum [lindex [split $pos "."] 1]
|
set posNum [lindex [split $pos "."] 1]
|
||||||
|
set box [$txt bbox insert]
|
||||||
|
set box_x [expr [lindex $box 0] + [winfo rootx $txt] ]
|
||||||
|
set box_y [expr [lindex $box 1] + [winfo rooty $txt] + [lindex $box 3] ]
|
||||||
SearchBrackets $txt
|
SearchBrackets $txt
|
||||||
# set lineStart [$txt index "$pos linestart"]
|
set lpos [split $pos "."]
|
||||||
# puts "$pos $lineStart"
|
set lblText "[::msgcat::mc "Row"]: [lindex $lpos 0], [::msgcat::mc "Column"]: [lindex $lpos 1]"
|
||||||
puts [$txt get [$txt index insert -1 word] $pos]
|
.frmStatus.lblPosition configure -text $lblText
|
||||||
set lastSymbol [string last " " [$txt get $lineNum.0 $pos]]
|
unset lpos
|
||||||
if {$cfgVariables(variableHelper) eq "true"} {
|
$txt tag remove lightSelected 1.0 end
|
||||||
set word [string trim [$txt get $lineNum.[expr $lastSymbol + 1] $pos]]
|
|
||||||
set box [$txt bbox insert]
|
|
||||||
set box_x [expr [lindex $box 0] + [winfo rootx $txt] ]
|
|
||||||
set box_y [expr [lindex $box 1] + [winfo rooty $txt] + [lindex $box 3] ]
|
|
||||||
Editor::VarHelper $box_x $box_y $txt $word $fileType
|
|
||||||
}
|
|
||||||
if {$cfgVariables(procedureHelper) eq "true"} {
|
|
||||||
puts "Find proc"
|
|
||||||
}
|
|
||||||
|
|
||||||
switch $k {
|
switch $k {
|
||||||
Return {
|
Return {
|
||||||
|
@ -528,12 +517,47 @@ namespace eval Editor {
|
||||||
$txt insert insert $spaceStart
|
$txt insert insert $spaceStart
|
||||||
Editor::Indent $txt
|
Editor::Indent $txt
|
||||||
}
|
}
|
||||||
|
Up {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Down {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Left {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Right {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# set lineStart [$txt index "$pos linestart"]
|
||||||
|
# puts "$pos $lineStart"
|
||||||
|
if {$cfgVariables(variableHelper) eq "true"} {
|
||||||
|
if {[dict exists $lexers $fileType variableSymbol] != 0} {
|
||||||
|
set varSymbol [dict get $lexers $fileType variableSymbol]
|
||||||
|
set lastSymbol [string last $varSymbol [$txt get $lineNum.0 $pos]]
|
||||||
|
if {$lastSymbol ne "-1"} {
|
||||||
|
set word [string trim [$txt get $lineNum.[expr $lastSymbol + 1] $pos]]
|
||||||
|
Editor::VarHelper $box_x $box_y $txt $word
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
set ind [$txt search -backwards -regexp {\W} $pos {insert linestart}]
|
||||||
|
if {$ind ne ""} {
|
||||||
|
set _ [split $ind "."]
|
||||||
|
set ind [lindex $_ 0].[expr [lindex $_ 1] + 1]
|
||||||
|
set word [$txt get $ind $pos]
|
||||||
|
Editor::VarHelper $box_x $box_y $txt $word
|
||||||
|
} else {
|
||||||
|
# set ind [$txt search -backwards -regexp {^} $pos {insert linestart}]
|
||||||
|
set word [$txt get {insert linestart} $pos]
|
||||||
|
Editor::VarHelper $box_x $box_y $txt $word
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$cfgVariables(procedureHelper) eq "true"} {
|
||||||
|
puts "Find proc"
|
||||||
}
|
}
|
||||||
set lpos [split $pos "."]
|
|
||||||
set lblText "[::msgcat::mc "Row"]: [lindex $lpos 0], [::msgcat::mc "Column"]: [lindex $lpos 1]"
|
|
||||||
.frmStatus.lblPosition configure -text $lblText
|
|
||||||
unset lpos
|
|
||||||
$txt tag remove lightSelected 1.0 end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc PressKey {k txt} {
|
proc PressKey {k txt} {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
# TCL/TK
|
# TCL/TK
|
||||||
dict set lexers TCL commentSymbol {#}
|
dict set lexers TCL commentSymbol {#}
|
||||||
|
dict set lexers TCL variableSymbol {$}
|
||||||
dict set lexers TCL procFindString {proc PROCNAME}
|
dict set lexers TCL procFindString {proc PROCNAME}
|
||||||
dict set lexers TCL procRegexpCommand {regexp -nocase -all -- {^\s*?(proc) (.*?) \{(.*?)\} \{} $line match keyWord procName params}
|
dict set lexers TCL procRegexpCommand {regexp -nocase -all -- {^\s*?(proc) (.*?) \{(.*?)\} \{} $line match keyWord procName params}
|
||||||
dict set lexers TCL varRegexpCommand {regexp -nocase -all -- {^\s*?set\s+([a-zA-Z0-9\:\-_$]+)\s+(.+?)($|;)} $line match varName varValue lineEnd}
|
dict set lexers TCL varRegexpCommand {regexp -nocase -all -- {^\s*?set\s+([a-zA-Z0-9\:\-_$]+)\s+(.+?)($|;)} $line match varName varValue lineEnd}
|
||||||
|
@ -19,6 +20,7 @@ dict set lexers GO varRegexpCommand {regexp -nocase -all -line -- {^\s*?var\s+([
|
||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
# SHELL (Bash)
|
# SHELL (Bash)
|
||||||
dict set lexers SH commentSymbol {#}
|
dict set lexers SH commentSymbol {#}
|
||||||
|
dict set lexers TCL variableSymbol {$}
|
||||||
dict set lexers SH procFindString {(function |)\s*?PROCNAME\(\)}
|
dict set lexers SH procFindString {(function |)\s*?PROCNAME\(\)}
|
||||||
dict set lexers SH procRegexpCommand {regexp -nocase -all -- {^\s*?(function |)\s*?(.*?)\(()\)} $line match keyWord procName params}
|
dict set lexers SH procRegexpCommand {regexp -nocase -all -- {^\s*?(function |)\s*?(.*?)\(()\)} $line match keyWord procName params}
|
||||||
|
|
||||||
|
@ -38,6 +40,7 @@ dict set lexers RB procRegexpCommand {regexp -nocase -all -- {^\s*?(def)\s([a-zA
|
||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
# YAML (ansible)
|
# YAML (ansible)
|
||||||
dict set lexers YML commentSymbol {#}
|
dict set lexers YML commentSymbol {#}
|
||||||
|
# dict set lexers YML variableSymbol {\{\{}
|
||||||
dict set lexers YML tabSize 2
|
dict set lexers YML tabSize 2
|
||||||
dict set lexers YML procFindString {(- name:)\s*?PROCNAME}
|
dict set lexers YML procFindString {(- name:)\s*?PROCNAME}
|
||||||
dict set lexers YML procRegexpCommand {regexp -nocase -all -- {^\s*?- (name):\s(.+?)$} $line match keyWord procName}
|
dict set lexers YML procRegexpCommand {regexp -nocase -all -- {^\s*?- (name):\s(.+?)$} $line match keyWord procName}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user