Repository navigation
Closed
Description
Describe the bug
I'm using OpenGrok 1.7.21 and I just indexed it from scratch (I removed all data directories). The Scopes Window is not working, it's always empty.
To Reproduce
Scroll up and down in some file, the Scope Window is always empty.
Expected behavior
The Scope information should be shown in the Scope Window.
Screenshots
The empty Scope Window:
The scope is correctly shown in the search page:
Additional context
A generated xref file:
...
<span id='scope_id_f392891b' class='scope-head'><span class='scope-signature'>tearDown()</span><a class="l" name="149" href="#149">149</a><a style='cursor:pointer;' onclick='fold(this.parentNode.id)' id='scope_id_f392891b_fold_icon'><span class='fold-icon'> </span></a> <b>public</b> <b>void</b> <a class="xmt" name="tearDown"/><a href="/source/s?refs=tearDown&project=code(master)" class="xmt intelliWindow-symbol" data-definition-place="def">tearDown</a>() <b>throws</b> <a href="/source/s?defs=Exception&project=code(master)" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Exception</a> {</span>
...
The ctags used:
> ctags --version
Universal Ctags 5.9.0(4dfe9287), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Oct 28 2021, 16:54:00
URL: https://ctags.io/
Optional compiled features: +wildcards, +regex, +gnulib_regex, +iconv, +option-directory, +packcc, +optscript
The ctags command executed:
ctags --kinds-c=+l --kinds-java=+l --kinds-sql=+l --kinds-Fortran=+L --kinds-C++=+l --extras=+F -u --filter=yes --filter-terminator=$'__ctags_done_with_file__\n' --fields=-af+iKnS --excmd=pattern --pattern-length-limit=180 --langdef=scala --regex-scala=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*(private|protected)?[[:space:]]*class[[:space:]]+([a-zA-Z0-9_]+)/\\4/c,classes/' --regex-scala=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*(private|protected)?[[:space:]]*object[[:space:]]+([a-zA-Z0-9_]+)/\\4/o,objects/' --regex-scala=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*(private|protected)?[[:space:]]*case class[[:space:]]+([a-zA-Z0-9_]+)/\\4/C,caseClasses/' --regex-scala=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*(private|protected)?[[:space:]]*case object[[:space:]]+([a-zA-Z0-9_]+)/\\4/O,caseObjects/' --regex-scala=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*(private|protected)?[[:space:]]*trait[[:space:]]+([a-zA-Z0-9_]+)/\\4/t,traits/' --regex-scala=$'/^[[:space:]]*type[[:space:]]+([a-zA-Z0-9_]+)/\\1/T,types/' --regex-scala=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy|private|protected)[[:space:]]*)*def[[:space:]]+([a-zA-Z0-9_]+)/\\3/m,methods/' --regex-scala=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*val[[:space:]]+([a-zA-Z0-9_]+)/\\3/l,constants/' --regex-scala=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*var[[:space:]]+([a-zA-Z0-9_]+)/\\3/v,variables/' --regex-scala=$'/^[[:space:]]*package[[:space:]]+([a-zA-Z0-9_.]+)/\\1/p,packages/' --regex-haskell=$'/^[[:space:]]*class[[:space:]]+([a-zA-Z0-9_]+)/\\1/c,classes/' --regex-haskell=$'/^[[:space:]]*data[[:space:]]+([a-zA-Z0-9_]+)/\\1/t,types/' --regex-haskell=$'/^[[:space:]]*newtype[[:space:]]+([a-zA-Z0-9_]+)/\\1/t,types/' --regex-haskell=$'/^[[:space:]]*type[[:space:]]+([a-zA-Z0-9_]+)/\\1/t,types/' --regex-haskell=$'/^([a-zA-Z0-9_]+).*[[:space:]]+={1}[[:space:]]+/\\1/f,functions/' --regex-haskell=$'/[[:space:]]+([a-zA-Z0-9_]+).*[[:space:]]+={1}[[:space:]]+/\\1/f,functions/' --regex-haskell=$'/^(let|where)[[:space:]]+([a-zA-Z0-9_]+).*[[:space:]]+={1}[[:space:]]+/\\2/f,functions/' --regex-haskell=$'/[[:space:]]+(let|where)[[:space:]]+([a-zA-Z0-9_]+).*[[:space:]]+={1}[[:space:]]+/\\2/f,functions/' --regex-clojure=$'/\\([[:space:]]*create-ns[[:space:]]+([-[:alnum:]*+!_:\\/.?]+)/\\1/n,namespace/' --regex-clojure=$'/\\([[:space:]]*def[[:space:]]+([-[:alnum:]*+!_:\\/.?]+)/\\1/d,definition/' --regex-clojure=$'/\\([[:space:]]*defn-[[:space:]]+([-[:alnum:]*+!_:\\/.?]+)/\\1/p,privateFunction/' --regex-clojure=$'/\\([[:space:]]*defmacro[[:space:]]+([-[:alnum:]*+!_:\\/.?]+)/\\1/m,macro/' --regex-clojure=$'/\\([[:space:]]*definline[[:space:]]+([-[:alnum:]*+!_:\\/.?]+)/\\1/i,inline/' --regex-clojure=$'/\\([[:space:]]*defmulti[[:space:]]+([-[:alnum:]*+!_:\\/.?]+)/\\1/a,multimethodDefinition/' --regex-clojure=$'/\\([[:space:]]*defmethod[[:space:]]+([-[:alnum:]*+!_:\\/.?]+)/\\1/b,multimethodInstance/' --regex-clojure=$'/\\([[:space:]]*defonce[[:space:]]+([-[:alnum:]*+!_:\\/.?]+)/\\1/c,definitionOnce/' --regex-clojure=$'/\\([[:space:]]*defstruct[[:space:]]+([-[:alnum:]*+!_:\\/.?]+)/\\1/s,struct/' --regex-clojure=$'/\\([[:space:]]*intern[[:space:]]+([-[:alnum:]*+!_:\\/.?]+)/\\1/v,intern/' --regex-kotlin=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*(private[^ ]*|protected)?[[:space:]]*class[[:space:]]+([[:alnum:]_:]+)/\\4/c,classes/' --regex-kotlin=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*(private[^ ]*|protected)?[[:space:]]*object[[:space:]]+([[:alnum:]_:]+)/\\4/o,objects/' --regex-kotlin=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*(private[^ ]*|protected)?[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*data class[[:space:]]+([[:alnum:]_:]+)/\\6/d,dataClasses/' --regex-kotlin=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*(private[^ ]*|protected)?[[:space:]]*interface[[:space:]]+([[:alnum:]_:]+)/\\4/i,interfaces/' --regex-kotlin=$'/^[[:space:]]*type[[:space:]]+([[:alnum:]_:]+)/\\1/T,types/' --regex-kotlin=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy|private[^ ]*(\\[[a-z]*\\])*|protected)[[:space:]]*)*fun[[:space:]]+([[:alnum:]_:]+)/\\4/m,methods/' --regex-kotlin=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy|private[^ ]*|protected)[[:space:]]*)*val[[:space:]]+([[:alnum:]_:]+)/\\3/C,constants/' --regex-kotlin=$'/^[[:space:]]*((abstract|final|sealed|implicit|lazy|private[^ ]*|protected)[[:space:]]*)*var[[:space:]]+([[:alnum:]_:]+)/\\3/v,variables/' --regex-kotlin=$'/^[[:space:]]*package[[:space:]]+([[:alnum:]_.:]+)/\\1/p,packages/' --regex-kotlin=$'/^[[:space:]]*import[[:space:]]+([[:alnum:]_.:]+)/\\1/I,imports/' --langdef=swift --regex-swift=$'/enum[[:space:]]+([^\\{\\}]+).*$/\\1/n,enum,enums/' --regex-swift=$'/typealias[[:space:]]+([^:=]+).*$/\\1/t,typealias,typealiases/' --regex-swift=$'/protocol[[:space:]]+([^:\\{]+).*$/\\1/p,protocol,protocols/' --regex-swift=$'/struct[[:space:]]+([^:\\{]+).*$/\\1/s,struct,structs/' --regex-swift=$'/class[[:space:]]+([^:\\{]+).*$/\\1/c,class,classes/' --regex-swift=$'/func[[:space:]]+([^\\(\\)]+)\\([^\\(\\)]*\\)/\\1/f,function,functions/' --regex-swift=$'/(var|let)[[:space:]]+([^:=]+).*$/\\2/v,variable,variables/' --regex-swift=$'/^[[:space:]]*extension[[:space:]]+([^:\\{]+).*$/\\1/e,extension,extensions/' --regex-rust=$'/^[[:space:]]*(pub[[:space:]]+)?(static|const)[[:space:]]+(mut[[:space:]]+)?([[:alnum:]_]+)/\\4/C,consts,staticConstants/' --regex-rust=$'/^[[:space:]]*(pub[[:space:]]+)?(unsafe[[:space:]]+)?impl([[:space:]\n]*<[^>]*>)?[[:space:]]+(([[:alnum:]_:]+)[[:space:]]*(<[^>]*>)?[[:space:]]+(for)[[:space:]]+)?([[:alnum:]_]+)/\\5 \\7 \\8/I,impls,traitImplementations/' --regex-rust=$'/^[[:space:]]*(pub[[:space:]]+)?(unsafe[[:space:]]+)?trait[[:space:]]+([[:alnum:]_]+)/\\3/r,traits,traits/' --regex-rust=$'/^[[:space:]]*let[[:space:]]+(mut)?[[:space:]]+([[:alnum:]_]+)/\\2/V,variables/' --regex-pascal=$'/([[:alnum:]_]+)[[:space:]]*=[[:space:]]*\\([[:space:]]*[[:alnum:]_][[:space:]]*\\)/\\1/t,Type/' --regex-pascal=$'/([[:alnum:]_]+)[[:space:]]*=[[:space:]]*class[[:space:]]*[^;]*$/\\1/c,Class/' --regex-pascal=$'/([[:alnum:]_]+)[[:space:]]*=[[:space:]]*interface[[:space:]]*[^;]*$/\\1/i,interface/' --regex-pascal=$'/^constructor[[:space:]]+(T[a-zA-Z0-9_]+(<[a-zA-Z0-9_, ]+>)?\\.)([a-zA-Z0-9_<>, ]+)(.*)+/\\1\\3/n,Constructor/' --regex-pascal=$'/^destructor[[:space:]]+(T[a-zA-Z0-9_]+(<[a-zA-Z0-9_, ]+>)?\\.)([a-zA-Z0-9_<>, ]+)(.*)+/\\1\\3/d,Destructor/' --regex-pascal=$'/^(procedure)[[:space:]]+T[a-zA-Z0-9_<>, ]+\\.([a-zA-Z0-9_<>, ]+)(.*)/\\2/p,procedure/' --regex-pascal=$'/^(function)[[:space:]]+T[a-zA-Z0-9_<>, ]+\\.([a-zA-Z0-9_<>, ]+)(.*)/\\2/f,function/' --regex-pascal=$'/^[[:space:]]*property[[:space:]]+([a-zA-Z0-9_<>, ]+)[[:space:]]*\\:(.*)/\\1/o,property/' --regex-pascal=$'/^(uses|interface|implementation)$/\\1/s,Section/' --regex-pascal=$'/^unit[[:space:]]+([a-zA-Z0-9_<>, ]+)[;(]/\\1/u,unit/' --regex-powershell=$'/\\$(\\{[^}]+\\})/\\1/v,variable/' --regex-powershell=$'/\\$([[:alnum:]_]+([:.][[:alnum:]_]+)*)/\\1/v,variable/' --regex-powershell=$'/^[[:space:]]*(:[^[:space:]]+)/\\1/l,label/' --_fielddef-powershell=$'signature,signatures' --fields-powershell=$'+{signature}' --regex-powershell=$'/`\\$([[:alnum:]_]+([:.][[:alnum:]_]+)*)/\\1//{exclusive}' --regex-powershell=$'/`\\$(\\{[^}]+\\})/\\1//{exclusive}' --regex-powershell=$'/#.*\\$([[:alnum:]_]+([:.][[:alnum:]_]+)*)/\\1//{exclusive}' --regex-powershell=$'/#.*\\$(\\{[^}]+\\})/\\1//{exclusive}' --regex-powershell=$'/^[[:space:]]*(function|filter)[[:space:]]+([^({[:space:]]+)[[:space:]]*(\\(([^)]+)\\))?/\\2/f,function,functions/{icase}{exclusive}{_field=signature:(\\4)}' --langdef=terraform --regex-terraform=$',^[[:space:]]*#,,{exclusive}' --regex-terraform=$',^[[:space:]]*//,,{exclusive}' --regex-terraform=$'/[[:<:]]resource[[:space:]]*"([[:alpha:]][-_[:alpha:]]*)"[[:space:]]*"([[:alpha:]][-_[:alpha:]]*)"[[:space:]]*\\{/\\1.\\2/s,struct,resource names/' --langmap=Ada:+.ada.Ada.ADA --langmap=Ada:+.adb.Adb.ADB --langmap=Ada:+.ads.Ads.ADS --langmap=Java:+.aidl.Aidl.AIDL --langmap=XML:+.asax.Asax.ASAX --langmap=XML:+.ascx.Ascx.ASCX --langmap=Asm:+.asm.Asm.ASM --langmap=XML:+.aspx.Aspx.ASPX --langmap=Sh:+.awk.Awk.AWK --langmap=Sh:+.bash.Bash.BASH --langmap=C:+.c.C --langmap=C++:+.c++.C++.C++ --langmap=C++:+.cc.Cc.CC --langmap=clojure:+.clj.Clj.CLJ --langmap=clojure:+.cljs.Cljs.CLJS --langmap=clojure:+.cljx.Cljx.CLJX --langmap=Sh:+.com.Com.COM --langmap=Sh:+.conf.Conf.CONF --langmap=C++:+.cpp.Cpp.CPP --langmap=$'C#:+.cs.Cs.CS' --langmap=Sh:+.csh.Csh.CSH --langmap=C++:+.cu.Cu.CU --langmap=C++:+.cuh.Cuh.CUH --langmap=C++:+.cxx.Cxx.CXX --langmap=C:+.d.D --langmap=Eiffel:+.e.E --langmap=Lisp:+.el.El.EL --langmap=Erlang:+.erl.Erl.ERL --langmap=Erlang:+.escript.Escript.ESCRIPT --langmap=Tcl:+.exp.Exp.EXP --langmap=Fortran:+.f.F --langmap=Fortran:+.f03.F03.F03 --langmap=Fortran:+.f08.F08.F08 --langmap=Fortran:+.f15.F15.F15 --langmap=Fortran:+.f90.F90.F90 --langmap=Fortran:+.f95.F95.F95 --langmap=Sh:+.flg.Flg.FLG --langmap=Sh:+.gmk.Gmk.GMK --langmap=Go:+.go.Go.GO --langmap=C:+.h.H --langmap=C++:+.hh.Hh.HH --langmap=C++:+.hpp.Hpp.HPP --langmap=Erlang:+.hrl.Hrl.HRL --langmap=haskell:+.hs.Hs.HS --langmap=haskell:+.hsc.Hsc.HSC --langmap=XML:+.htm.Htm.HTM --langmap=XML:+.html.Html.HTML --langmap=C++:+.hxx.Hxx.HXX --langmap=C:+.i.I --langmap=Tcl:+.itcl.Itcl.ITCL --langmap=Tcl:+.itk.Itk.ITK --langmap=Java:+.jav.Jav.JAV --langmap=Java:+.java.Java.JAVA --langmap=JavaScript:+.js.Js.JS --langmap=JSON:+.json.Json.JSON --langmap=Sh:+.ksh.Ksh.KSH --langmap=Sh:+.kshlib.Kshlib.KSHLIB --langmap=kotlin:+.kt.Kt.KT --langmap=kotlin:+.kts.Kts.KTS --langmap=C:+.l.L --langmap=C:+.lex.Lex.LEX --langmap=Lisp:+.lisp.Lisp.LISP --langmap=Lisp:+.lsp.Lsp.LSP --langmap=Lua:+.lua.Lua.LUA --langmap=XML:+.master.Master.MASTER --langmap=Sh:+.mk.Mk.MK --langmap=Sh:+.p5.P5.P5 --langmap=pascal:+.pas.Pas.PAS --langmap=SQL:+.pck.Pck.PCK --langmap=Perl:+.perl.Perl.PERL --langmap=Perl:+.ph.Ph.PH --langmap=PHP:+.php.Php.PHP --langmap=PHP:+.php3.Php3.PHP3 --langmap=PHP:+.php4.Php4.PHP4 --langmap=PHP:+.phps.Phps.PHPS --langmap=PHP:+.phtml.Phtml.PHTML --langmap=SQL:+.pkb.Pkb.PKB --langmap=SQL:+.pks.Pks.PKS --langmap=Perl:+.pl.Pl.PL --langmap=SQL:+.plb.Plb.PLB --langmap=SQL:+.pld.Pld.PLD --langmap=SQL:+.pls.Pls.PLS --langmap=Perl:+.plx.Plx.PLX --langmap=Perl:+.pm.Pm.PM --langmap=powershell:+.ps1.Ps1.PS1 --langmap=powershell:+.psm1.Psm1.PSM1 --langmap=Python:+.py.Py.PY --langmap=R:+.r.R --langmap=Ruby:+.rb.Rb.RB --langmap=R:+.rda.Rda.RDA --langmap=R:+.rdata.Rdata.RDATA --langmap=R:+.rds.Rds.RDS --langmap=rust:+.rs.Rs.RS --langmap=Ruby:+.ruby.Ruby.RUBY --langmap=Asm:+.s.S --langmap=scala:+.scala.Scala.SCALA --langmap=Lisp:+.scm.Scm.SCM --langmap=Sh:+.sh.Sh.SH --langmap=Sh:+.spec.Spec.SPEC --langmap=SQL:+.sql.Sql.SQL --langmap=SystemVerilog:+.sv.Sv.SV --langmap=SystemVerilog:+.svh.Svh.SVH --langmap=swift:+.swift.Swift.SWIFT --langmap=C++:+.tcc.Tcc.TCC --langmap=Tcl:+.tcl.Tcl.TCL --langmap=Tcl:+.tclx.Tclx.TCLX --langmap=terraform:+.tf.Tf.TF --langmap=terraform:+.tfvars.Tfvars.TFVARS --langmap=Tcl:+.tk.Tk.TK --langmap=Tcl:+.tm.Tm.TM --langmap=C++:+.txx.Txx.TXX --langmap=SystemVerilog:+.v.V --langmap=SystemVerilog:+.vh.Vh.VH --langmap=Tcl:+.wish.Wish.WISH --langmap=C:+.x.X --langmap=XML:+.xaml.Xaml.XAML --langmap=Sh:+.xcl.Xcl.XCL --langmap=XML:+.xml.Xml.XML --langmap=C:+.xs.Xs.XS --langmap=C:+.y.Y --langmap=C:+.yacc.Yacc.YACC --langmap=$'Sh:+([mM][aA][kK][eE][fF][iI][lL][eE]*)'


Activity
ahornace commentedon Nov 22, 2021
They seem to work for me on http://demo.opengrok.org/ and locally with a full reindex from scratch. I've tried using Safari and Chrome.
Is the problem persistent across all projects and files or only in a particular file? What browser are you using? Can you try with the newest Chrome? Can you check if you have any warnings/errors in the browser console?
marceloavilaoliveira commentedon Nov 23, 2021
The Scopes Window works pretty well for me on http://demo.opengrok.org too. In my server, it doesn't work in any project, in Chrome (96.0.4664.45) or Firefox (94.0.2).
There're no errors in the browser console:
Is there something more I can verify?
ahornace commentedon Nov 24, 2021
Since the xref contains the
scope-headelements, then it should not be a problem with index. Also, your code should not be an issue. You should be able to verify this by indexing any project from http://demo.opengrok.org/ and comparing the scopes.I'd suggest to debug the javascript execution by appending
debug=truequery param and adding a breakpoint toscope_on_scrollfunction. Could you please check if the function is called and which condition is not satisfied when the scope should be shown?marceloavilaoliveira commentedon Nov 24, 2021
Thanks for the ideas, I finally could find the root cause. The "scope_on_scroll" function is correctly called, the problem happens in the following highlighted line:
It seems that it never finds the scope head and body due to the "header_include" file. If I remove the "header_include" file the "Scopes Window" works correctly.
Our "header_include" file is pretty simple:
I don't know what I need to change to fix the problem.
ahornace commentedon Nov 24, 2021
The problem seems to be the
heightsetting of70pxforwhole_headerelement. Because the JS call of$('#whole_header').outerHeight()will return this value instead of the actual size which is actually greater, thendocument.elementFromPoint(15, y + 1);will always point to the header itself and will not find the scope.I'll investigate if we can remove the height setting altogether or if it's needed. Thanks for debugging! :)
ahornace commentedon Nov 25, 2021
The height needs to be there because of the fixed position of the header. You should be able to fix the problem by creating
http_header_includefile with:The
85pxis just a random value and should be tweaked based on your actual header size (approx. 65px + your header size).We should add a note to https://github.com/oracle/opengrok/wiki/Webapp-configuration#include-files
I was also thinking of creating a css var for this which would then make the above override a bit simpler, e.g.:
marceloavilaoliveira commentedon Nov 25, 2021
Great, the "Scopes Window" worked very well with the proposed "http_header_include" file.
I had to let some spare room just in case the file path is too long and the line is wrapped like in the following example:
Thanks a lot.
ahornace commentedon Nov 25, 2021
You are welcome. I'm debating if we should not get rid of the fixed header approach and make just the content scrollable. That way it should be far more flexible.
ahornace commentedon Nov 25, 2021
Closing as there is a workaround and the proper fix should come with UI overhaul.