diff --git a/go.mod b/go.mod index c254f23..93df76f 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.24.3 require ( github.com/charmbracelet/log v0.4.0 github.com/efritz/pentimento v0.0.0-20190429011147-ade47d831101 - github.com/sourcegraph/scip v0.4.1-0.20240819152428-9c4970218f55 - golang.org/x/tools v0.36.0 + github.com/sourcegraph/scip v0.6.1-0.20251013155313-75e68ad1bbd3 + golang.org/x/tools v0.37.0 golang.org/x/tools/go/vcs v0.1.0-deprecated ) @@ -49,13 +49,15 @@ require ( github.com/rivo/uniseg v0.4.7 // indirect github.com/rs/cors v1.9.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect + github.com/sourcegraph/beaut v0.0.0-20240611013027-627e4c25335a // indirect github.com/tetratelabs/wazero v1.3.0 // indirect github.com/vbatts/tar-split v0.11.3 // indirect go.opentelemetry.io/otel v1.16.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sync v0.16.0 // indirect + golang.org/x/sync v0.17.0 // indirect + golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 // indirect ) require ( @@ -79,7 +81,7 @@ require ( github.com/imdario/mergo v0.3.4 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jdxcode/netrc v0.0.0-20221124155335-4616370d1a84 // indirect - github.com/klauspost/compress v1.16.7 // indirect + github.com/klauspost/compress v1.18.0 // indirect github.com/klauspost/pgzip v1.2.6 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect @@ -90,21 +92,21 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pseudomuto/protoc-gen-doc v1.5.1 // indirect github.com/pseudomuto/protokit v0.2.0 // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.41.0 // indirect - golang.org/x/exp v0.0.0-20231006140011-7918f672742d - golang.org/x/mod v0.27.0 - golang.org/x/net v0.43.0 // indirect - golang.org/x/sys v0.35.0 // indirect - golang.org/x/term v0.34.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/crypto v0.42.0 // indirect + golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 + golang.org/x/mod v0.28.0 + golang.org/x/net v0.44.0 // indirect + golang.org/x/sys v0.36.0 // indirect + golang.org/x/term v0.35.0 // indirect + golang.org/x/text v0.29.0 // indirect google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 // indirect google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 59a4364..c24c817 100644 --- a/go.sum +++ b/go.sum @@ -258,8 +258,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= @@ -361,8 +361,8 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= @@ -379,8 +379,10 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/sourcegraph/scip v0.4.1-0.20240819152428-9c4970218f55 h1:nWDV+MS84Q4Yc4lN/VkZWv9jOxIGa//XbulVmXokrJM= -github.com/sourcegraph/scip v0.4.1-0.20240819152428-9c4970218f55/go.mod h1:ES3wAdR/OLCEBiTx1psZf6RL4/+DK59D8yNLFiC+KqA= +github.com/sourcegraph/beaut v0.0.0-20240611013027-627e4c25335a h1:j/CQ27s679M9wRGBRJYyXGrfkYuQA6VMnD7R08mHD9c= +github.com/sourcegraph/beaut v0.0.0-20240611013027-627e4c25335a/go.mod h1:JG1sdvGTKWwe/oH3/3UKQ26vfcHIN//7fwEJhoqaBcM= +github.com/sourcegraph/scip v0.6.1-0.20251013155313-75e68ad1bbd3 h1:MIOYepsIoOtY14Xq832Sj0cfcblhyt/LPbeB+E9BIxI= +github.com/sourcegraph/scip v0.6.1-0.20251013155313-75e68ad1bbd3/go.mod h1:c6d9mk1cGT6OXdHutxDakKVEPN1D+iFoYWCsrDxEhus= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= @@ -402,8 +404,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tetratelabs/wazero v1.3.0 h1:nqw7zCldxE06B8zSZAY0ACrR9OH5QCcPwYmYlwtcwtE= github.com/tetratelabs/wazero v1.3.0/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -458,11 +460,11 @@ golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= -golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= +golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI= +golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 h1:mchzmB1XO2pMaKFRqk/+MV3mgGG96aqaPXaMifQU47w= +golang.org/x/exp v0.0.0-20231108232855-2478ac86f678/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -471,8 +473,8 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= -golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= +golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U= +golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -494,8 +496,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= +golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -506,8 +508,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= -golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -540,19 +542,21 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220906165534-d0df966e6959/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= -golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= +golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 h1:dHQOQddU4YHS5gY33/6klKjq7Gp3WwMyOXGNp5nzRj8= +golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053/go.mod h1:+nZKN+XVh4LCiA9DV3ywrzN4gumyCnKjau3NGb9SGoE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= -golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= +golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ= +golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= +golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -571,8 +575,8 @@ golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= -golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= +golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE= +golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w= golang.org/x/tools/go/vcs v0.1.0-deprecated h1:cOIJqWBl99H1dH5LWizPa+0ImeeJq3t3cJjaeOWUAL4= golang.org/x/tools/go/vcs v0.1.0-deprecated/go.mod h1:zUrvATBAvEI9535oC0yWYsLsHIV4Z7g63sNPVMtuBy8= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/index/scip.go b/internal/index/scip.go index 856e257..0677566 100644 --- a/internal/index/scip.go +++ b/internal/index/scip.go @@ -131,6 +131,9 @@ func Index(writer func(proto.Message), opts config.IndexOpts) error { continue } + enclosingNodeMap := map[*ast.Ident]ast.Node{} + visitors.EnclosingNodeMap(f, enclosingNodeMap) + // If possible, any state required for created a scip document // should be contained in the visitor. This makes sure that we can // garbage collect everything that's there after each loop, @@ -142,6 +145,7 @@ func Index(writer func(proto.Message), opts config.IndexOpts) error { allPackages, pkgSymbols, globalSymbols, + enclosingNodeMap, ) // Traverse the file diff --git a/internal/testdata/snapshots/output/alias/main.go b/internal/testdata/snapshots/output/alias/main.go index dbf2548..7f3971d 100755 --- a/internal/testdata/snapshots/output/alias/main.go +++ b/internal/testdata/snapshots/output/alias/main.go @@ -72,6 +72,7 @@ // > ``` ) +//⌄ enclosing_range_start github.com/sourcegraph/scip-go . `github.com/sourcegraph/scip-go/internal/testdata/snapshots/input/alias`/f(). func f(u U) {} // ^ definition github.com/sourcegraph/scip-go . `github.com/sourcegraph/scip-go/internal/testdata/snapshots/input/alias`/f(). // documentation @@ -80,4 +81,5 @@ // > ``` // ^ definition local 0 // ^ reference github.com/sourcegraph/scip-go . `github.com/sourcegraph/scip-go/internal/testdata/snapshots/input/alias`/U# +// ⌃ enclosing_range_end github.com/sourcegraph/scip-go . `github.com/sourcegraph/scip-go/internal/testdata/snapshots/input/alias`/f(). diff --git a/internal/testdata/snapshots/output/embedded/embedded.go b/internal/testdata/snapshots/output/embedded/embedded.go index a549184..b8a9766 100755 --- a/internal/testdata/snapshots/output/embedded/embedded.go +++ b/internal/testdata/snapshots/output/embedded/embedded.go @@ -33,6 +33,7 @@ // ^^^ reference github.com/golang/go/src go1.22 `os/exec`/Cmd# } +//⌄ enclosing_range_start 0.1.test `sg/embedded`/wrapExecCommand(). func wrapExecCommand(c *exec.Cmd) { // ^^^^^^^^^^^^^^^ definition 0.1.test `sg/embedded`/wrapExecCommand(). // documentation @@ -47,6 +48,7 @@ // ^^^ reference 0.1.test `sg/embedded`/osExecCommand#Cmd. // ^ reference local 0 } +//⌃ enclosing_range_end 0.1.test `sg/embedded`/wrapExecCommand(). type Inner struct { // ^^^^^ definition 0.1.test `sg/embedded`/Inner# @@ -110,6 +112,7 @@ // > ``` } +//⌄ enclosing_range_start 0.1.test `sg/embedded`/useOfCompositeStructs(). func useOfCompositeStructs() { // ^^^^^^^^^^^^^^^^^^^^^ definition 0.1.test `sg/embedded`/useOfCompositeStructs(). // documentation @@ -145,4 +148,5 @@ // ^^^^^ reference 0.1.test `sg/embedded`/Outer#Inner. // ^ reference 0.1.test `sg/embedded`/Inner#Y. } +//⌃ enclosing_range_end 0.1.test `sg/embedded`/useOfCompositeStructs(). diff --git a/internal/testdata/snapshots/output/embedded/internal/nested.go b/internal/testdata/snapshots/output/embedded/internal/nested.go index dc150eb..db50f6d 100755 --- a/internal/testdata/snapshots/output/embedded/internal/nested.go +++ b/internal/testdata/snapshots/output/embedded/internal/nested.go @@ -10,6 +10,7 @@ // ^^^^^^^^^^^ reference 0.1.test `sg/embedded`/ ) +//⌄ enclosing_range_start 0.1.test `sg/embedded/internal`/Something(). func Something(recent embedded.RecentCommittersResults) { // ^^^^^^^^^ definition 0.1.test `sg/embedded/internal`/Something(). // documentation @@ -36,4 +37,5 @@ } } } +//⌃ enclosing_range_end 0.1.test `sg/embedded/internal`/Something(). diff --git a/internal/testdata/snapshots/output/embedded/nested.go b/internal/testdata/snapshots/output/embedded/nested.go index e61cdbe..00e809f 100755 --- a/internal/testdata/snapshots/output/embedded/nested.go +++ b/internal/testdata/snapshots/output/embedded/nested.go @@ -38,6 +38,7 @@ // > ``` } +//⌄ enclosing_range_start 0.1.test `sg/embedded`/NestedExample(). func NestedExample(n NestedHandler) { // ^^^^^^^^^^^^^ definition 0.1.test `sg/embedded`/NestedExample(). // documentation @@ -57,4 +58,5 @@ // ^ reference local 0 // ^^^^^ reference 0.1.test `sg/embedded`/NestedHandler#Other. } +//⌃ enclosing_range_end 0.1.test `sg/embedded`/NestedExample(). diff --git a/internal/testdata/snapshots/output/generallyeric/generallyeric.go b/internal/testdata/snapshots/output/generallyeric/generallyeric.go index edc76f2..9e402b4 100755 --- a/internal/testdata/snapshots/output/generallyeric/generallyeric.go +++ b/internal/testdata/snapshots/output/generallyeric/generallyeric.go @@ -7,6 +7,7 @@ import "fmt" // ^^^ reference github.com/golang/go/src go1.22 fmt/ +//⌄ enclosing_range_start 0.1.test `sg/generallyeric`/Print(). func Print[T any](s []T) { // ^^^^^ definition 0.1.test `sg/generallyeric`/Print(). // documentation @@ -25,4 +26,5 @@ // ^ reference local 2 } } +//⌃ enclosing_range_end 0.1.test `sg/generallyeric`/Print(). diff --git a/internal/testdata/snapshots/output/generallyeric/new_operators.go b/internal/testdata/snapshots/output/generallyeric/new_operators.go index 29b70ca..0263860 100755 --- a/internal/testdata/snapshots/output/generallyeric/new_operators.go +++ b/internal/testdata/snapshots/output/generallyeric/new_operators.go @@ -25,6 +25,7 @@ // ^^^^^^^ reference golang.org/x/exp 47842c84f3db `golang.org/x/exp/constraints`/Complex# } +//⌄ enclosing_range_start 0.1.test `sg/generallyeric`/Double(). func Double[T Number](value T) T { // ^^^^^^ definition 0.1.test `sg/generallyeric`/Double(). // documentation @@ -39,6 +40,7 @@ return value * 2 // ^^^^^ reference local 1 } +//⌃ enclosing_range_end 0.1.test `sg/generallyeric`/Double(). type Box[T any] struct { // ^^^ definition 0.1.test `sg/generallyeric`/Box# diff --git a/internal/testdata/snapshots/output/generallyeric/person.go b/internal/testdata/snapshots/output/generallyeric/person.go index 0e0f156..9330b9e 100755 --- a/internal/testdata/snapshots/output/generallyeric/person.go +++ b/internal/testdata/snapshots/output/generallyeric/person.go @@ -32,6 +32,7 @@ // > ``` // relationship 0.1.test `sg/generallyeric`/Person# implementation +//⌄ enclosing_range_start 0.1.test `sg/generallyeric`/worker#Work(). func (w worker) Work() { // ^ definition local 0 // ^^^^^^ reference 0.1.test `sg/generallyeric`/worker# @@ -46,7 +47,9 @@ // ^^^^^^ reference github.com/golang/go/src go1.22 fmt/Printf(). // ^ reference local 0 } +//⌃ enclosing_range_end 0.1.test `sg/generallyeric`/worker#Work(). +//⌄ enclosing_range_start 0.1.test `sg/generallyeric`/DoWork(). func DoWork[T Person](things []T) { // ^^^^^^ definition 0.1.test `sg/generallyeric`/DoWork(). // documentation @@ -65,7 +68,9 @@ // ^^^^ reference 0.1.test `sg/generallyeric`/Person#Work. } } +//⌃ enclosing_range_end 0.1.test `sg/generallyeric`/DoWork(). +//⌄ enclosing_range_start 0.1.test `sg/generallyeric`/main(). func main() { // ^^^^ definition 0.1.test `sg/generallyeric`/main(). // documentation @@ -90,4 +95,5 @@ // ^ reference local 5 // ^ reference local 6 } +//⌃ enclosing_range_end 0.1.test `sg/generallyeric`/main(). diff --git a/internal/testdata/snapshots/output/impls/impls.go b/internal/testdata/snapshots/output/impls/impls.go index 144c2ce..01532d5 100755 --- a/internal/testdata/snapshots/output/impls/impls.go +++ b/internal/testdata/snapshots/output/impls/impls.go @@ -79,6 +79,7 @@ // relationship 0.1.test `sg/impls`/I1# implementation // relationship 0.1.test `sg/impls`/I1Clone# implementation +//⌄ enclosing_range_start 0.1.test `sg/impls`/T1#F1(). func (r T1) F1() {} // ^ definition local 0 // ^^ reference 0.1.test `sg/impls`/T1# @@ -89,6 +90,7 @@ // > ``` // relationship 0.1.test `sg/impls`/I1#F1. implementation // relationship 0.1.test `sg/impls`/I1Clone#F1. implementation +// ⌃ enclosing_range_end 0.1.test `sg/impls`/T1#F1(). type T2 int // ^^ definition 0.1.test `sg/impls`/T2# @@ -99,6 +101,7 @@ // relationship 0.1.test `sg/impls`/I1# implementation // relationship 0.1.test `sg/impls`/I1Clone# implementation +//⌄ enclosing_range_start 0.1.test `sg/impls`/T2#F1(). func (r T2) F1() {} // ^ definition local 1 // ^^ reference 0.1.test `sg/impls`/T2# @@ -109,6 +112,8 @@ // > ``` // relationship 0.1.test `sg/impls`/I1#F1. implementation // relationship 0.1.test `sg/impls`/I1Clone#F1. implementation +// ⌃ enclosing_range_end 0.1.test `sg/impls`/T2#F1(). +//⌄ enclosing_range_start 0.1.test `sg/impls`/T2#F2(). func (r T2) F2() {} // ^ definition local 2 // ^^ reference 0.1.test `sg/impls`/T2# @@ -117,4 +122,5 @@ // > ```go // > func (T2).F2() // > ``` +// ⌃ enclosing_range_end 0.1.test `sg/impls`/T2#F2(). diff --git a/internal/testdata/snapshots/output/impls/remote_impls.go b/internal/testdata/snapshots/output/impls/remote_impls.go index beb69cb..cd3eebd 100755 --- a/internal/testdata/snapshots/output/impls/remote_impls.go +++ b/internal/testdata/snapshots/output/impls/remote_impls.go @@ -4,6 +4,7 @@ import "net/http" // ^^^^^^^^ reference github.com/golang/go/src go1.22 `net/http`/ +//⌄ enclosing_range_start 0.1.test `sg/impls`/Something(). func Something(r http.ResponseWriter) {} // ^^^^^^^^^ definition 0.1.test `sg/impls`/Something(). // documentation @@ -13,6 +14,7 @@ // ^ definition local 0 // ^^^^ reference github.com/golang/go/src go1.22 `net/http`/ // ^^^^^^^^^^^^^^ reference github.com/golang/go/src go1.22 `net/http`/ResponseWriter# +// ⌃ enclosing_range_end 0.1.test `sg/impls`/Something(). type MyWriter struct{} // ^^^^^^^^ definition 0.1.test `sg/impls`/MyWriter# @@ -29,6 +31,7 @@ // relationship github.com/golang/go/src go1.22 `net/http`/ResponseWriter# implementation // relationship github.com/golang/go/src go1.22 io/Writer# implementation +//⌄ enclosing_range_start 0.1.test `sg/impls`/MyWriter#Header(). func (w MyWriter) Header() http.Header { panic("") } // ^ definition local 1 // ^^^^^^^^ reference 0.1.test `sg/impls`/MyWriter# @@ -40,6 +43,8 @@ // relationship github.com/golang/go/src go1.22 `net/http`/ResponseWriter#Header. implementation // ^^^^ reference github.com/golang/go/src go1.22 `net/http`/ // ^^^^^^ reference github.com/golang/go/src go1.22 `net/http`/Header# +// ⌃ enclosing_range_end 0.1.test `sg/impls`/MyWriter#Header(). +//⌄ enclosing_range_start 0.1.test `sg/impls`/MyWriter#Write(). func (w MyWriter) Write([]byte) (int, error) { panic("") } // ^ definition local 2 // ^^^^^^^^ reference 0.1.test `sg/impls`/MyWriter# @@ -52,6 +57,8 @@ // relationship github.com/golang/go/src go1.22 `internal/bisect`/Writer#Write. implementation // relationship github.com/golang/go/src go1.22 `net/http`/ResponseWriter#Write. implementation // relationship github.com/golang/go/src go1.22 io/Writer#Write. implementation +// ⌃ enclosing_range_end 0.1.test `sg/impls`/MyWriter#Write(). +//⌄ enclosing_range_start 0.1.test `sg/impls`/MyWriter#WriteHeader(). func (w MyWriter) WriteHeader(statusCode int) { panic("") } // ^ definition local 3 // ^^^^^^^^ reference 0.1.test `sg/impls`/MyWriter# @@ -62,7 +69,9 @@ // > ``` // relationship github.com/golang/go/src go1.22 `net/http`/ResponseWriter#WriteHeader. implementation // ^^^^^^^^^^ definition local 4 +// ⌃ enclosing_range_end 0.1.test `sg/impls`/MyWriter#WriteHeader(). +//⌄ enclosing_range_start 0.1.test `sg/impls`/Another(). func Another() { // ^^^^^^^ definition 0.1.test `sg/impls`/Another(). // documentation @@ -73,4 +82,5 @@ // ^^^^^^^^^ reference 0.1.test `sg/impls`/Something(). // ^^^^^^^^ reference 0.1.test `sg/impls`/MyWriter# } +//⌃ enclosing_range_end 0.1.test `sg/impls`/Another(). diff --git a/internal/testdata/snapshots/output/initial/builtin_types.go b/internal/testdata/snapshots/output/initial/builtin_types.go index ee5f42a..7ab7e27 100755 --- a/internal/testdata/snapshots/output/initial/builtin_types.go +++ b/internal/testdata/snapshots/output/initial/builtin_types.go @@ -1,6 +1,7 @@ package initial // ^^^^^^^ reference 0.1.test `sg/initial`/ +//⌄ enclosing_range_start 0.1.test `sg/initial`/UsesBuiltin(). func UsesBuiltin() int { // ^^^^^^^^^^^ definition 0.1.test `sg/initial`/UsesBuiltin(). // documentation @@ -12,4 +13,5 @@ return x // ^ reference local 0 } +//⌃ enclosing_range_end 0.1.test `sg/initial`/UsesBuiltin(). diff --git a/internal/testdata/snapshots/output/initial/child_symbols.go b/internal/testdata/snapshots/output/initial/child_symbols.go index ebe1df6..77f2ece 100755 --- a/internal/testdata/snapshots/output/initial/child_symbols.go +++ b/internal/testdata/snapshots/output/initial/child_symbols.go @@ -247,6 +247,7 @@ } // StructMethod has some docs! +//⌄ enclosing_range_start 0.1.test `sg/initial`/Struct#StructMethod(). func (s *Struct) StructMethod() {} // ^ definition local 0 // ^^^^^^ reference 0.1.test `sg/initial`/Struct# @@ -257,7 +258,9 @@ // > ``` // documentation // > StructMethod has some docs! +// ⌃ enclosing_range_end 0.1.test `sg/initial`/Struct#StructMethod(). +//⌄ enclosing_range_start 0.1.test `sg/initial`/Struct#ImplementsInterface(). func (s *Struct) ImplementsInterface() string { return "hi!" } // ^ definition local 1 // ^^^^^^ reference 0.1.test `sg/initial`/Struct# @@ -267,7 +270,9 @@ // > func (*Struct).ImplementsInterface() string // > ``` // relationship 0.1.test `sg/initial`/Interface#ImplementsInterface. implementation +// ⌃ enclosing_range_end 0.1.test `sg/initial`/Struct#ImplementsInterface(). +//⌄ enclosing_range_start 0.1.test `sg/initial`/Struct#MachineLearning(). func (s *Struct) MachineLearning( // ^ definition local 2 // ^^^^^^ reference 0.1.test `sg/initial`/Struct# @@ -321,6 +326,7 @@ // ^^^^^^^^^^^ reference local 4 // ^^^^^^^^^^^ reference local 5 } +//⌃ enclosing_range_end 0.1.test `sg/initial`/Struct#MachineLearning(). // Interface has docs too type Interface interface { @@ -345,6 +351,7 @@ // > ``` } +//⌄ enclosing_range_start 0.1.test `sg/initial`/NewInterface(). func NewInterface() Interface { return nil } // ^^^^^^^^^^^^ definition 0.1.test `sg/initial`/NewInterface(). // documentation @@ -352,6 +359,7 @@ // > func NewInterface() Interface // > ``` // ^^^^^^^^^ reference 0.1.test `sg/initial`/Interface# +// ⌃ enclosing_range_end 0.1.test `sg/initial`/NewInterface(). var SortExportedFirst = 1 // ^^^^^^^^^^^^^^^^^ definition 0.1.test `sg/initial`/SortExportedFirst. diff --git a/internal/testdata/snapshots/output/initial/func_declarations.go b/internal/testdata/snapshots/output/initial/func_declarations.go index ecdfa5e..441f3ad 100755 --- a/internal/testdata/snapshots/output/initial/func_declarations.go +++ b/internal/testdata/snapshots/output/initial/func_declarations.go @@ -1,6 +1,7 @@ package initial // ^^^^^^^ reference 0.1.test `sg/initial`/ +//⌄ enclosing_range_start 0.1.test `sg/initial`/UsesLater(). func UsesLater() { // ^^^^^^^^^ definition 0.1.test `sg/initial`/UsesLater(). // documentation @@ -10,11 +11,14 @@ DefinedLater() // ^^^^^^^^^^^^ reference 0.1.test `sg/initial`/DefinedLater(). } +//⌃ enclosing_range_end 0.1.test `sg/initial`/UsesLater(). +//⌄ enclosing_range_start 0.1.test `sg/initial`/DefinedLater(). func DefinedLater() {} // ^^^^^^^^^^^^ definition 0.1.test `sg/initial`/DefinedLater(). // documentation // > ```go // > func DefinedLater() // > ``` +// ⌃ enclosing_range_end 0.1.test `sg/initial`/DefinedLater(). diff --git a/internal/testdata/snapshots/output/initial/methods_and_receivers.go b/internal/testdata/snapshots/output/initial/methods_and_receivers.go index d5ae9af..ac8264a 100755 --- a/internal/testdata/snapshots/output/initial/methods_and_receivers.go +++ b/internal/testdata/snapshots/output/initial/methods_and_receivers.go @@ -28,6 +28,7 @@ // > struct field y int // > ``` +//⌄ enclosing_range_start 0.1.test `sg/initial`/MyStruct#RecvFunction(). func (m MyStruct) RecvFunction(b int) int { return m.f + b } // ^ definition local 0 // ^^^^^^^^ reference 0.1.test `sg/initial`/MyStruct# @@ -40,7 +41,9 @@ // ^ reference local 0 // ^ reference 0.1.test `sg/initial`/MyStruct#f. // ^ reference local 1 +// ⌃ enclosing_range_end 0.1.test `sg/initial`/MyStruct#RecvFunction(). +//⌄ enclosing_range_start 0.1.test `sg/initial`/SomethingElse(). func SomethingElse() { // ^^^^^^^^^^^^^ definition 0.1.test `sg/initial`/SomethingElse(). // documentation @@ -56,4 +59,5 @@ // ^^^^^^^ reference github.com/golang/go/src go1.22 fmt/Println(). // ^ reference local 2 } +//⌃ enclosing_range_end 0.1.test `sg/initial`/SomethingElse(). diff --git a/internal/testdata/snapshots/output/initial/rangefunc.go b/internal/testdata/snapshots/output/initial/rangefunc.go index f2c06ff..6a9836f 100755 --- a/internal/testdata/snapshots/output/initial/rangefunc.go +++ b/internal/testdata/snapshots/output/initial/rangefunc.go @@ -6,6 +6,7 @@ // ^^^^^^ reference github.com/golang/go/src go1.22 slices/ ) +//⌄ enclosing_range_start 0.1.test `sg/initial`/f(). func f(xs []int) int { // ^ definition 0.1.test `sg/initial`/f(). // documentation @@ -23,4 +24,5 @@ } return -1 } +//⌃ enclosing_range_end 0.1.test `sg/initial`/f(). diff --git a/internal/testdata/snapshots/output/initial/toplevel_decls.go b/internal/testdata/snapshots/output/initial/toplevel_decls.go index 00f1f66..255ca4f 100755 --- a/internal/testdata/snapshots/output/initial/toplevel_decls.go +++ b/internal/testdata/snapshots/output/initial/toplevel_decls.go @@ -15,6 +15,7 @@ // > ``` // ^^^^^^^^ reference 0.1.test `sg/initial`/MY_THING. +//⌄ enclosing_range_start 0.1.test `sg/initial`/usesMyThing(). func usesMyThing() { // ^^^^^^^^^^^ definition 0.1.test `sg/initial`/usesMyThing(). // documentation @@ -24,6 +25,7 @@ _ = MY_THING // ^^^^^^^^ reference 0.1.test `sg/initial`/MY_THING. } +//⌃ enclosing_range_end 0.1.test `sg/initial`/usesMyThing(). var initFunctions = map[string]int{} // ^^^^^^^^^^^^^ definition 0.1.test `sg/initial`/initFunctions. diff --git a/internal/testdata/snapshots/output/inlinestruct/inlinestruct.go b/internal/testdata/snapshots/output/inlinestruct/inlinestruct.go index 334f2b2..70f5909 100755 --- a/internal/testdata/snapshots/output/inlinestruct/inlinestruct.go +++ b/internal/testdata/snapshots/output/inlinestruct/inlinestruct.go @@ -45,6 +45,7 @@ // ^^^^^^^^^^^^^^ reference 0.1.test `sg/inlinestruct`/FieldInterface# }{} +//⌄ enclosing_range_start 0.1.test `sg/inlinestruct`/MyFunc(). func MyFunc() { // ^^^^^^ definition 0.1.test `sg/inlinestruct`/MyFunc(). // documentation @@ -58,4 +59,5 @@ // ^^^^^^^^ reference 0.1.test `sg/inlinestruct`/MyInline. // ^^^^^^^^^^^ reference 0.1.test `sg/inlinestruct`/MyInline:PublicField. } +//⌃ enclosing_range_end 0.1.test `sg/inlinestruct`/MyFunc(). diff --git a/internal/testdata/snapshots/output/inlinestruct/inlinestruct_genericindex.go b/internal/testdata/snapshots/output/inlinestruct/inlinestruct_genericindex.go index f5da0ee..5d76b16 100755 --- a/internal/testdata/snapshots/output/inlinestruct/inlinestruct_genericindex.go +++ b/internal/testdata/snapshots/output/inlinestruct/inlinestruct_genericindex.go @@ -49,6 +49,7 @@ // > struct{} // > ``` +//⌄ enclosing_range_start 0.1.test `sg/inlinestruct`/ProcessImpl#Process(). func (p *ProcessImpl) Process(payload Limit) { panic("not implemented") } // ^ definition local 2 // ^^^^^^^^^^^ reference 0.1.test `sg/inlinestruct`/ProcessImpl# @@ -59,6 +60,8 @@ // > ``` // ^^^^^^^ definition local 3 // ^^^^^ reference 0.1.test `sg/inlinestruct`/Limit# +// ⌃ enclosing_range_end 0.1.test `sg/inlinestruct`/ProcessImpl#Process(). +//⌄ enclosing_range_start 0.1.test `sg/inlinestruct`/ProcessImpl#ProcessorType(). func (p *ProcessImpl) ProcessorType() string { panic("not implemented") } // ^ definition local 4 // ^^^^^^^^^^^ reference 0.1.test `sg/inlinestruct`/ProcessImpl# @@ -67,6 +70,7 @@ // > ```go // > func (*ProcessImpl).ProcessorType() string // > ``` +// ⌃ enclosing_range_end 0.1.test `sg/inlinestruct`/ProcessImpl#ProcessorType(). var _ Processor[Limit] = &ProcessImpl{} // ^^^^^^^^^ reference 0.1.test `sg/inlinestruct`/Processor# diff --git a/internal/testdata/snapshots/output/inlinestruct/inlinestruct_interface.go b/internal/testdata/snapshots/output/inlinestruct/inlinestruct_interface.go index bc5e703..0eb2c63 100755 --- a/internal/testdata/snapshots/output/inlinestruct/inlinestruct_interface.go +++ b/internal/testdata/snapshots/output/inlinestruct/inlinestruct_interface.go @@ -4,6 +4,7 @@ import "context" // ^^^^^^^ reference github.com/golang/go/src go1.22 context/ +//⌄ enclosing_range_start 0.1.test `sg/inlinestruct`/Target(). func Target() interface { // ^^^^^^ definition 0.1.test `sg/inlinestruct`/Target(). // documentation @@ -45,7 +46,9 @@ } { panic("not implemented") } +//⌃ enclosing_range_end 0.1.test `sg/inlinestruct`/Target(). +//⌄ enclosing_range_start 0.1.test `sg/inlinestruct`/something(). func something() { // ^^^^^^^^^ definition 0.1.test `sg/inlinestruct`/something(). // documentation @@ -61,4 +64,5 @@ // ^^^^^^^ reference github.com/golang/go/src go1.22 context/ // ^^^^^^^^^^ reference github.com/golang/go/src go1.22 context/Background(). } +//⌃ enclosing_range_end 0.1.test `sg/inlinestruct`/something(). diff --git a/internal/testdata/snapshots/output/package-documentation/primary.go b/internal/testdata/snapshots/output/package-documentation/primary.go index aec3ce5..e3ccebf 100755 --- a/internal/testdata/snapshots/output/package-documentation/primary.go +++ b/internal/testdata/snapshots/output/package-documentation/primary.go @@ -4,10 +4,12 @@ // documentation // > This is documentation for this package. +//⌄ enclosing_range_start github.com/sourcegraph/scip-go . `github.com/sourcegraph/scip-go/internal/testdata/snapshots/input/package-documentation`/Exported(). func Exported() {} // ^^^^^^^^ definition github.com/sourcegraph/scip-go . `github.com/sourcegraph/scip-go/internal/testdata/snapshots/input/package-documentation`/Exported(). // documentation // > ```go // > func Exported() // > ``` +// ⌃ enclosing_range_end github.com/sourcegraph/scip-go . `github.com/sourcegraph/scip-go/internal/testdata/snapshots/input/package-documentation`/Exported(). diff --git a/internal/testdata/snapshots/output/package-documentation/secondary.go b/internal/testdata/snapshots/output/package-documentation/secondary.go index 5698163..dda5e1f 100755 --- a/internal/testdata/snapshots/output/package-documentation/secondary.go +++ b/internal/testdata/snapshots/output/package-documentation/secondary.go @@ -1,10 +1,12 @@ package packagedocumentation // ^^^^^^^^^^^^^^^^^^^^ reference github.com/sourcegraph/scip-go . `github.com/sourcegraph/scip-go/internal/testdata/snapshots/input/package-documentation`/ +//⌄ enclosing_range_start github.com/sourcegraph/scip-go . `github.com/sourcegraph/scip-go/internal/testdata/snapshots/input/package-documentation`/AlsoExporter(). func AlsoExporter() {} // ^^^^^^^^^^^^ definition github.com/sourcegraph/scip-go . `github.com/sourcegraph/scip-go/internal/testdata/snapshots/input/package-documentation`/AlsoExporter(). // documentation // > ```go // > func AlsoExporter() // > ``` +// ⌃ enclosing_range_end github.com/sourcegraph/scip-go . `github.com/sourcegraph/scip-go/internal/testdata/snapshots/input/package-documentation`/AlsoExporter(). diff --git a/internal/testdata/snapshots/output/replace-directives/replace_directives.go b/internal/testdata/snapshots/output/replace-directives/replace_directives.go index dda4338..4b564b6 100755 --- a/internal/testdata/snapshots/output/replace-directives/replace_directives.go +++ b/internal/testdata/snapshots/output/replace-directives/replace_directives.go @@ -11,6 +11,7 @@ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ reference github.com/sourcegraph/gologin c6f1b62954d8 `github.com/dghubble/gologin`/ ) +//⌄ enclosing_range_start 0.1.test `sg/replace-directives`/Something(). func Something() { // ^^^^^^^^^ definition 0.1.test `sg/replace-directives`/Something(). // documentation @@ -23,4 +24,5 @@ // ^^^^^^^ reference github.com/sourcegraph/gologin c6f1b62954d8 `github.com/dghubble/gologin`/ // ^^^^^^^^^^^^^^^^^^^ reference github.com/sourcegraph/gologin c6f1b62954d8 `github.com/dghubble/gologin`/DefaultCookieConfig. } +//⌃ enclosing_range_end 0.1.test `sg/replace-directives`/Something(). diff --git a/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/cleanup.go b/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/cleanup.go index 6df94d4..cac051d 100755 --- a/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/cleanup.go +++ b/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/cleanup.go @@ -1,10 +1,12 @@ package server // ^^^^^^ reference 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/ +//⌄ enclosing_range_start 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/LiterallyAnything(). func LiterallyAnything() {} // ^^^^^^^^^^^^^^^^^ definition 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/LiterallyAnything(). // documentation // > ```go // > func LiterallyAnything() // > ``` +// ⌃ enclosing_range_end 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/LiterallyAnything(). diff --git a/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/cleanup_test.go b/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/cleanup_test.go index 98ed031..8a413ff 100755 --- a/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/cleanup_test.go +++ b/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/cleanup_test.go @@ -4,6 +4,7 @@ import "testing" // ^^^^^^^ reference github.com/golang/go/src go1.22 testing/ +//⌄ enclosing_range_start 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/TestStuff(). func TestStuff(t *testing.T) { // ^^^^^^^^^ definition 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/TestStuff(). // documentation @@ -24,4 +25,5 @@ // ^^ reference local 1 // ^^^^ reference local 2 } +//⌃ enclosing_range_end 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/TestStuff(). diff --git a/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/server.go b/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/server.go index bdcbb71..e72bff5 100755 --- a/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/server.go +++ b/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/server.go @@ -3,10 +3,12 @@ // documentation // > package server +//⌄ enclosing_range_start 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/AnythingAtAll(). func AnythingAtAll() {} // ^^^^^^^^^^^^^ definition 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/AnythingAtAll(). // documentation // > ```go // > func AnythingAtAll() // > ``` +// ⌃ enclosing_range_end 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/AnythingAtAll(). diff --git a/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/server_test.go b/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/server_test.go index 8ee6dda..9270cd0 100755 --- a/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/server_test.go +++ b/internal/testdata/snapshots/output/sharedtestmodule/cmd/gitserver/server/server_test.go @@ -4,6 +4,7 @@ import "testing" // ^^^^^^^ reference github.com/golang/go/src go1.22 testing/ +//⌄ enclosing_range_start 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/TestExecRequest(). func TestExecRequest(t *testing.T) { // ^^^^^^^^^^^^^^^ definition 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/TestExecRequest(). // documentation @@ -17,7 +18,9 @@ // ^ reference local 0 // ^^^ reference github.com/golang/go/src go1.22 testing/common#Log(). } +//⌃ enclosing_range_end 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/TestExecRequest(). +//⌄ enclosing_range_start 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/runCmd(). func runCmd(t *testing.T, dir string, cmd string, arg ...string) {} // ^^^^^^ definition 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/runCmd(). // documentation @@ -30,4 +33,5 @@ // ^^^ definition local 2 // ^^^ definition local 3 // ^^^ definition local 4 +// ⌃ enclosing_range_end 0.1.test `sg/sharedtestmodule/cmd/gitserver/server`/runCmd(). diff --git a/internal/testdata/snapshots/output/switches/switches.go b/internal/testdata/snapshots/output/switches/switches.go index 290e35e..afd3338 100755 --- a/internal/testdata/snapshots/output/switches/switches.go +++ b/internal/testdata/snapshots/output/switches/switches.go @@ -18,6 +18,7 @@ // > ``` // Something does some things... and stuff +//⌄ enclosing_range_start 0.1.test `sg/switches`/CustomSwitch#Something(). func (c *CustomSwitch) Something() bool { return false } // ^ definition local 0 // ^^^^^^^^^^^^ reference 0.1.test `sg/switches`/CustomSwitch# @@ -28,7 +29,9 @@ // > ``` // documentation // > Something does some things... and stuff +// ⌃ enclosing_range_end 0.1.test `sg/switches`/CustomSwitch#Something(). +//⌄ enclosing_range_start 0.1.test `sg/switches`/Switch(). func Switch(interfaceValue interface{}) bool { // ^^^^^^ definition 0.1.test `sg/switches`/Switch(). // documentation @@ -66,4 +69,5 @@ return false } } +//⌃ enclosing_range_end 0.1.test `sg/switches`/Switch(). diff --git a/internal/testdata/snapshots/output/testdata/anonymous_structs.go b/internal/testdata/snapshots/output/testdata/anonymous_structs.go index 2f126ef..d944bc4 100755 --- a/internal/testdata/snapshots/output/testdata/anonymous_structs.go +++ b/internal/testdata/snapshots/output/testdata/anonymous_structs.go @@ -72,6 +72,7 @@ } } +//⌄ enclosing_range_start 0.1.test `sg/testdata`/funcContainingAnonymousStructs(). func funcContainingAnonymousStructs() { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition 0.1.test `sg/testdata`/funcContainingAnonymousStructs(). // documentation @@ -177,4 +178,5 @@ // ^ reference 0.1.test `sg/testdata`/TypeContainingAnonymousStructs#c. // ^ reference 0.1.test `sg/testdata`/TypeContainingAnonymousStructs#c.Y. } +//⌃ enclosing_range_end 0.1.test `sg/testdata`/funcContainingAnonymousStructs(). diff --git a/internal/testdata/snapshots/output/testdata/cmd/minimal_main/minimal_main.go b/internal/testdata/snapshots/output/testdata/cmd/minimal_main/minimal_main.go index 0cac7be..9f1c327 100755 --- a/internal/testdata/snapshots/output/testdata/cmd/minimal_main/minimal_main.go +++ b/internal/testdata/snapshots/output/testdata/cmd/minimal_main/minimal_main.go @@ -40,10 +40,12 @@ // > struct{} // > ``` +//⌄ enclosing_range_start 0.1.test `sg/testdata/cmd/minimal_main`/main(). func main() {} // ^^^^ definition 0.1.test `sg/testdata/cmd/minimal_main`/main(). // documentation // > ```go // > func main() // > ``` +// ⌃ enclosing_range_end 0.1.test `sg/testdata/cmd/minimal_main`/main(). diff --git a/internal/testdata/snapshots/output/testdata/conflicting_test_symbols/sandbox_unsupported_test.go b/internal/testdata/snapshots/output/testdata/conflicting_test_symbols/sandbox_unsupported_test.go index 6c1faa8..128caac 100755 --- a/internal/testdata/snapshots/output/testdata/conflicting_test_symbols/sandbox_unsupported_test.go +++ b/internal/testdata/snapshots/output/testdata/conflicting_test_symbols/sandbox_unsupported_test.go @@ -22,6 +22,7 @@ // ^^^^^^ reference github.com/golang/go/src go1.22 errors/ // ^^^ reference github.com/golang/go/src go1.22 errors/New(). +//⌄ enclosing_range_start 0.1.test `sg/testdata/conflicting_test_symbols`/newKey(). func newKey(t *testing.T) (string, error) { // ^^^^^^ definition 0.1.test `sg/testdata/conflicting_test_symbols`/newKey(). // documentation @@ -34,7 +35,9 @@ return "", ErrNotImplemented // ^^^^^^^^^^^^^^^^^ reference 0.1.test `sg/testdata/conflicting_test_symbols`/ErrNotImplemented. } +//⌃ enclosing_range_end 0.1.test `sg/testdata/conflicting_test_symbols`/newKey(). +//⌄ enclosing_range_start 0.1.test `sg/testdata/conflicting_test_symbols`/verifySandbox(). func verifySandbox(t *testing.T, s string) { // ^^^^^^^^^^^^^ definition 0.1.test `sg/testdata/conflicting_test_symbols`/verifySandbox(). // documentation @@ -47,4 +50,5 @@ // ^ definition local 2 return } +//⌃ enclosing_range_end 0.1.test `sg/testdata/conflicting_test_symbols`/verifySandbox(). diff --git a/internal/testdata/snapshots/output/testdata/data.go b/internal/testdata/snapshots/output/testdata/data.go index 3e82e8e..a4fb5b4 100755 --- a/internal/testdata/snapshots/output/testdata/data.go +++ b/internal/testdata/snapshots/output/testdata/data.go @@ -191,6 +191,7 @@ // ^^^^^^^^^^^ reference 0.1.test `sg/testdata`/StringAlias# // Doer is similar to the test interface (but not the same). +//⌄ enclosing_range_start 0.1.test `sg/testdata`/TestStruct#Doer(). func (ts *TestStruct) Doer(ctx context.Context, data string) (score int, err error) { // ^^ definition local 3 // ^^^^^^^^^^ reference 0.1.test `sg/testdata`/TestStruct# @@ -210,6 +211,7 @@ return Score, nil // ^^^^^ reference 0.1.test `sg/testdata`/Score. } +//⌃ enclosing_range_end 0.1.test `sg/testdata`/TestStruct#Doer(). // StructTagRegression is a struct that caused panic in the wild. Added here to // support a regression test. diff --git a/internal/testdata/snapshots/output/testdata/duplicate_path_id/main.go b/internal/testdata/snapshots/output/testdata/duplicate_path_id/main.go index 7dc6a91..b647f4a 100755 --- a/internal/testdata/snapshots/output/testdata/duplicate_path_id/main.go +++ b/internal/testdata/snapshots/output/testdata/duplicate_path_id/main.go @@ -23,6 +23,7 @@ // > struct{} // > ``` +//⌄ enclosing_range_start 0.1.test `sg/testdata/duplicate_path_id`/fetchMeta(). func fetchMeta() (string, *importMeta, *sourceMeta) { // ^^^^^^^^^ definition 0.1.test `sg/testdata/duplicate_path_id`/fetchMeta(). // documentation @@ -33,23 +34,30 @@ // ^^^^^^^^^^ reference 0.1.test `sg/testdata/duplicate_path_id`/sourceMeta# panic("hmm") } +//⌃ enclosing_range_end 0.1.test `sg/testdata/duplicate_path_id`/fetchMeta(). +//⌄ enclosing_range_start 0.1.test `sg/testdata/duplicate_path_id`/init(). func init() {} // ^^^^ definition 0.1.test `sg/testdata/duplicate_path_id`/init(). // documentation // > ```go // > func init() // > ``` +// ⌃ enclosing_range_end 0.1.test `sg/testdata/duplicate_path_id`/init(). +//⌄ enclosing_range_start 0.1.test `sg/testdata/duplicate_path_id`/init(). func init() {} // ^^^^ definition 0.1.test `sg/testdata/duplicate_path_id`/init(). // documentation // > ```go // > func init() // > ``` +// ⌃ enclosing_range_end 0.1.test `sg/testdata/duplicate_path_id`/init(). +//⌄ enclosing_range_start 0.1.test `sg/testdata/duplicate_path_id`/init(). func init() {} // ^^^^ definition 0.1.test `sg/testdata/duplicate_path_id`/init(). // documentation // > ```go // > func init() // > ``` +// ⌃ enclosing_range_end 0.1.test `sg/testdata/duplicate_path_id`/init(). diff --git a/internal/testdata/snapshots/output/testdata/duplicate_path_id/two.go b/internal/testdata/snapshots/output/testdata/duplicate_path_id/two.go index 4792ca6..f85af41 100755 --- a/internal/testdata/snapshots/output/testdata/duplicate_path_id/two.go +++ b/internal/testdata/snapshots/output/testdata/duplicate_path_id/two.go @@ -3,10 +3,12 @@ // documentation // > package gosrc +//⌄ enclosing_range_start 0.1.test `sg/testdata/duplicate_path_id`/init(). func init() {} // ^^^^ definition 0.1.test `sg/testdata/duplicate_path_id`/init(). // documentation // > ```go // > func init() // > ``` +// ⌃ enclosing_range_end 0.1.test `sg/testdata/duplicate_path_id`/init(). diff --git a/internal/testdata/snapshots/output/testdata/implementations.go b/internal/testdata/snapshots/output/testdata/implementations.go index c5d41bb..b67c12c 100755 --- a/internal/testdata/snapshots/output/testdata/implementations.go +++ b/internal/testdata/snapshots/output/testdata/implementations.go @@ -60,6 +60,7 @@ // > ``` // relationship 0.1.test `sg/testdata`/I1# implementation +//⌄ enclosing_range_start 0.1.test `sg/testdata`/T1#F1(). func (r T1) F1() {} // ^ definition local 0 // ^^ reference 0.1.test `sg/testdata`/T1# @@ -69,6 +70,7 @@ // > func (T1).F1() // > ``` // relationship 0.1.test `sg/testdata`/I1#F1. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/T1#F1(). type T2 int // ^^ definition 0.1.test `sg/testdata`/T2# @@ -79,6 +81,7 @@ // relationship 0.1.test `sg/testdata`/I1# implementation // relationship 0.1.test `sg/testdata`/I2# implementation +//⌄ enclosing_range_start 0.1.test `sg/testdata`/T2#F1(). func (r T2) F1() {} // ^ definition local 1 // ^^ reference 0.1.test `sg/testdata`/T2# @@ -88,6 +91,8 @@ // > func (T2).F1() // > ``` // relationship 0.1.test `sg/testdata`/I1#F1. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/T2#F1(). +//⌄ enclosing_range_start 0.1.test `sg/testdata`/T2#F2(). func (r T2) F2() {} // ^ definition local 2 // ^^ reference 0.1.test `sg/testdata`/T2# @@ -97,6 +102,7 @@ // > func (T2).F2() // > ``` // relationship 0.1.test `sg/testdata`/I2#F2. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/T2#F2(). type A1 = T1 // ^^ definition 0.1.test `sg/testdata`/A1# @@ -164,6 +170,7 @@ // relationship 0.1.test `sg/testdata`/InterfaceWithExportedMethod# implementation // relationship 0.1.test `sg/testdata`/InterfaceWithNonExportedMethod# implementation +//⌄ enclosing_range_start 0.1.test `sg/testdata`/Foo#nonExportedMethod(). func (r Foo) nonExportedMethod() {} // ^ definition local 3 // ^^^ reference 0.1.test `sg/testdata`/Foo# @@ -173,6 +180,8 @@ // > func (Foo).nonExportedMethod() // > ``` // relationship 0.1.test `sg/testdata`/InterfaceWithNonExportedMethod#nonExportedMethod. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/Foo#nonExportedMethod(). +//⌄ enclosing_range_start 0.1.test `sg/testdata`/Foo#ExportedMethod(). func (r Foo) ExportedMethod() {} // ^ definition local 4 // ^^^ reference 0.1.test `sg/testdata`/Foo# @@ -182,6 +191,8 @@ // > func (Foo).ExportedMethod() // > ``` // relationship 0.1.test `sg/testdata`/InterfaceWithExportedMethod#ExportedMethod. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/Foo#ExportedMethod(). +//⌄ enclosing_range_start 0.1.test `sg/testdata`/Foo#Close(). func (r Foo) Close() error { return nil } // ^ definition local 5 // ^^^ reference 0.1.test `sg/testdata`/Foo# @@ -192,6 +203,7 @@ // > ``` // relationship github.com/golang/go/src go1.22 io/Closer#Close. implementation // relationship 0.1.test `sg/testdata`/I3#Close. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/Foo#Close(). type SharedOne interface { // ^^^^^^^^^ definition 0.1.test `sg/testdata`/SharedOne# @@ -260,6 +272,7 @@ // relationship 0.1.test `sg/testdata`/SharedOne# implementation // relationship 0.1.test `sg/testdata`/SharedTwo# implementation +//⌄ enclosing_range_start 0.1.test `sg/testdata`/Between#Shared(). func (Between) Shared() {} // ^^^^^^^ reference 0.1.test `sg/testdata`/Between# // ^^^^^^ definition 0.1.test `sg/testdata`/Between#Shared(). @@ -269,6 +282,8 @@ // > ``` // relationship 0.1.test `sg/testdata`/SharedOne#Shared. implementation // relationship 0.1.test `sg/testdata`/SharedTwo#Shared. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/Between#Shared(). +//⌄ enclosing_range_start 0.1.test `sg/testdata`/Between#Distinct(). func (Between) Distinct() {} // ^^^^^^^ reference 0.1.test `sg/testdata`/Between# // ^^^^^^^^ definition 0.1.test `sg/testdata`/Between#Distinct(). @@ -277,6 +292,8 @@ // > func (Between).Distinct() // > ``` // relationship 0.1.test `sg/testdata`/SharedOne#Distinct. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/Between#Distinct(). +//⌄ enclosing_range_start 0.1.test `sg/testdata`/Between#Unique(). func (Between) Unique() {} // ^^^^^^^ reference 0.1.test `sg/testdata`/Between# // ^^^^^^ definition 0.1.test `sg/testdata`/Between#Unique(). @@ -285,7 +302,9 @@ // > func (Between).Unique() // > ``` // relationship 0.1.test `sg/testdata`/SharedTwo#Unique. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/Between#Unique(). +//⌄ enclosing_range_start 0.1.test `sg/testdata`/shouldShow(). func shouldShow(shared SharedOne) { // ^^^^^^^^^^ definition 0.1.test `sg/testdata`/shouldShow(). // documentation @@ -298,4 +317,5 @@ // ^^^^^^ reference local 6 // ^^^^^^ reference 0.1.test `sg/testdata`/SharedOne#Shared. } +//⌃ enclosing_range_end 0.1.test `sg/testdata`/shouldShow(). diff --git a/internal/testdata/snapshots/output/testdata/implementations_methods.go b/internal/testdata/snapshots/output/testdata/implementations_methods.go index 8efe336..2cbe659 100755 --- a/internal/testdata/snapshots/output/testdata/implementations_methods.go +++ b/internal/testdata/snapshots/output/testdata/implementations_methods.go @@ -33,6 +33,7 @@ // > ``` // relationship 0.1.test `sg/testdata`/InterfaceWithSingleMethod# implementation +//⌄ enclosing_range_start 0.1.test `sg/testdata`/StructWithMethods#SingleMethod(). func (StructWithMethods) SingleMethod() float64 { return 5.0 } // ^^^^^^^^^^^^^^^^^ reference 0.1.test `sg/testdata`/StructWithMethods# // ^^^^^^^^^^^^ definition 0.1.test `sg/testdata`/StructWithMethods#SingleMethod(). @@ -41,6 +42,7 @@ // > func (StructWithMethods).SingleMethod() float64 // > ``` // relationship 0.1.test `sg/testdata`/InterfaceWithSingleMethod#SingleMethod. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/StructWithMethods#SingleMethod(). type InterfaceWithSingleMethodTwoImplementers interface { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition 0.1.test `sg/testdata`/InterfaceWithSingleMethodTwoImplementers# @@ -74,6 +76,7 @@ // > ``` // relationship 0.1.test `sg/testdata`/InterfaceWithSingleMethodTwoImplementers# implementation +//⌄ enclosing_range_start 0.1.test `sg/testdata`/TwoImplOne#SingleMethodTwoImpl(). func (TwoImplOne) SingleMethodTwoImpl() float64 { return 5.0 } // ^^^^^^^^^^ reference 0.1.test `sg/testdata`/TwoImplOne# // ^^^^^^^^^^^^^^^^^^^ definition 0.1.test `sg/testdata`/TwoImplOne#SingleMethodTwoImpl(). @@ -82,6 +85,7 @@ // > func (TwoImplOne).SingleMethodTwoImpl() float64 // > ``` // relationship 0.1.test `sg/testdata`/InterfaceWithSingleMethodTwoImplementers#SingleMethodTwoImpl. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/TwoImplOne#SingleMethodTwoImpl(). type TwoImplTwo struct{} // ^^^^^^^^^^ definition 0.1.test `sg/testdata`/TwoImplTwo# @@ -95,6 +99,7 @@ // > ``` // relationship 0.1.test `sg/testdata`/InterfaceWithSingleMethodTwoImplementers# implementation +//⌄ enclosing_range_start 0.1.test `sg/testdata`/TwoImplTwo#SingleMethodTwoImpl(). func (TwoImplTwo) SingleMethodTwoImpl() float64 { return 5.0 } // ^^^^^^^^^^ reference 0.1.test `sg/testdata`/TwoImplTwo# // ^^^^^^^^^^^^^^^^^^^ definition 0.1.test `sg/testdata`/TwoImplTwo#SingleMethodTwoImpl(). @@ -103,6 +108,8 @@ // > func (TwoImplTwo).SingleMethodTwoImpl() float64 // > ``` // relationship 0.1.test `sg/testdata`/InterfaceWithSingleMethodTwoImplementers#SingleMethodTwoImpl. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/TwoImplTwo#SingleMethodTwoImpl(). +//⌄ enclosing_range_start 0.1.test `sg/testdata`/TwoImplTwo#RandomThingThatDoesntMatter(). func (TwoImplTwo) RandomThingThatDoesntMatter() float64 { return 5.0 } // ^^^^^^^^^^ reference 0.1.test `sg/testdata`/TwoImplTwo# // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition 0.1.test `sg/testdata`/TwoImplTwo#RandomThingThatDoesntMatter(). @@ -110,4 +117,5 @@ // > ```go // > func (TwoImplTwo).RandomThingThatDoesntMatter() float64 // > ``` +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/TwoImplTwo#RandomThingThatDoesntMatter(). diff --git a/internal/testdata/snapshots/output/testdata/implementations_remote.go b/internal/testdata/snapshots/output/testdata/implementations_remote.go index 9ce7f29..f431920 100755 --- a/internal/testdata/snapshots/output/testdata/implementations_remote.go +++ b/internal/testdata/snapshots/output/testdata/implementations_remote.go @@ -19,6 +19,7 @@ // relationship github.com/golang/go/src go1.22 `net/http`/ResponseWriter# implementation // relationship github.com/golang/go/src go1.22 io/Writer# implementation +//⌄ enclosing_range_start 0.1.test `sg/testdata`/implementsWriter#Header(). func (implementsWriter) Header() http.Header { panic("Just for how") } // ^^^^^^^^^^^^^^^^ reference 0.1.test `sg/testdata`/implementsWriter# // ^^^^^^ definition 0.1.test `sg/testdata`/implementsWriter#Header(). @@ -29,6 +30,8 @@ // relationship github.com/golang/go/src go1.22 `net/http`/ResponseWriter#Header. implementation // ^^^^ reference github.com/golang/go/src go1.22 `net/http`/ // ^^^^^^ reference github.com/golang/go/src go1.22 `net/http`/Header# +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/implementsWriter#Header(). +//⌄ enclosing_range_start 0.1.test `sg/testdata`/implementsWriter#Write(). func (implementsWriter) Write([]byte) (int, error) { panic("Just for show") } // ^^^^^^^^^^^^^^^^ reference 0.1.test `sg/testdata`/implementsWriter# // ^^^^^ definition 0.1.test `sg/testdata`/implementsWriter#Write(). @@ -40,6 +43,8 @@ // relationship github.com/golang/go/src go1.22 `internal/bisect`/Writer#Write. implementation // relationship github.com/golang/go/src go1.22 `net/http`/ResponseWriter#Write. implementation // relationship github.com/golang/go/src go1.22 io/Writer#Write. implementation +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/implementsWriter#Write(). +//⌄ enclosing_range_start 0.1.test `sg/testdata`/implementsWriter#WriteHeader(). func (implementsWriter) WriteHeader(statusCode int) {} // ^^^^^^^^^^^^^^^^ reference 0.1.test `sg/testdata`/implementsWriter# // ^^^^^^^^^^^ definition 0.1.test `sg/testdata`/implementsWriter#WriteHeader(). @@ -49,7 +54,9 @@ // > ``` // relationship github.com/golang/go/src go1.22 `net/http`/ResponseWriter#WriteHeader. implementation // ^^^^^^^^^^ definition local 0 +// ⌃ enclosing_range_end 0.1.test `sg/testdata`/implementsWriter#WriteHeader(). +//⌄ enclosing_range_start 0.1.test `sg/testdata`/ShowsInSignature(). func ShowsInSignature(respWriter http.ResponseWriter) { // ^^^^^^^^^^^^^^^^ definition 0.1.test `sg/testdata`/ShowsInSignature(). // documentation @@ -63,4 +70,5 @@ // ^^^^^^^^^^ reference local 1 // ^^^^^^^^^^^ reference github.com/golang/go/src go1.22 `net/http`/ResponseWriter#WriteHeader. } +//⌃ enclosing_range_end 0.1.test `sg/testdata`/ShowsInSignature(). diff --git a/internal/testdata/snapshots/output/testdata/named_import.go b/internal/testdata/snapshots/output/testdata/named_import.go index c0b8ded..1a02fb1 100755 --- a/internal/testdata/snapshots/output/testdata/named_import.go +++ b/internal/testdata/snapshots/output/testdata/named_import.go @@ -9,6 +9,7 @@ // ^^^^^^^^ reference github.com/golang/go/src go1.22 `net/http`/ ) +//⌄ enclosing_range_start 0.1.test `sg/testdata`/Example(). func Example() { // ^^^^^^^ definition 0.1.test `sg/testdata`/Example(). // documentation @@ -20,4 +21,5 @@ // ^ reference local 0 // ^^^^^^^^^^^^^^^^^^ reference github.com/golang/go/src go1.22 `net/http`/CanonicalHeaderKey(). } +//⌃ enclosing_range_end 0.1.test `sg/testdata`/Example(). diff --git a/internal/testdata/snapshots/output/testdata/parallel.go b/internal/testdata/snapshots/output/testdata/parallel.go index f4f25a0..b0575a0 100755 --- a/internal/testdata/snapshots/output/testdata/parallel.go +++ b/internal/testdata/snapshots/output/testdata/parallel.go @@ -25,6 +25,7 @@ // Parallel invokes each of the given parallelizable functions in their own goroutines and // returns the first error to occur. This method will block until all goroutines have returned. +//⌄ enclosing_range_start 0.1.test `sg/testdata`/Parallel(). func Parallel(ctx context.Context, fns ...ParallelizableFunc) error { // ^^^^^^^^ definition 0.1.test `sg/testdata`/Parallel(). // documentation @@ -84,4 +85,5 @@ return nil } +//⌃ enclosing_range_end 0.1.test `sg/testdata`/Parallel(). diff --git a/internal/testdata/snapshots/output/testdata/typeswitch.go b/internal/testdata/snapshots/output/testdata/typeswitch.go index f70cf6c..743227a 100755 --- a/internal/testdata/snapshots/output/testdata/typeswitch.go +++ b/internal/testdata/snapshots/output/testdata/typeswitch.go @@ -1,6 +1,7 @@ package testdata // ^^^^^^^^ reference 0.1.test `sg/testdata`/ +//⌄ enclosing_range_start 0.1.test `sg/testdata`/Switch(). func Switch(interfaceValue interface{}) bool { // ^^^^^^ definition 0.1.test `sg/testdata`/Switch(). // documentation @@ -29,4 +30,5 @@ return false } } +//⌃ enclosing_range_end 0.1.test `sg/testdata`/Switch(). diff --git a/internal/testdata/snapshots/output/testspecial/foo.go b/internal/testdata/snapshots/output/testspecial/foo.go index e1aae65..0ba160c 100755 --- a/internal/testdata/snapshots/output/testspecial/foo.go +++ b/internal/testdata/snapshots/output/testspecial/foo.go @@ -3,10 +3,12 @@ // documentation // > package testspecial +//⌄ enclosing_range_start 0.1.test `sg/testspecial`/Foo(). func Foo() {} // ^^^ definition 0.1.test `sg/testspecial`/Foo(). // documentation // > ```go // > func Foo() // > ``` +// ⌃ enclosing_range_end 0.1.test `sg/testspecial`/Foo(). diff --git a/internal/testdata/snapshots/output/testspecial/foo_other_test.go b/internal/testdata/snapshots/output/testspecial/foo_other_test.go index 39ba768..6045f77 100755 --- a/internal/testdata/snapshots/output/testspecial/foo_other_test.go +++ b/internal/testdata/snapshots/output/testspecial/foo_other_test.go @@ -11,6 +11,7 @@ // ^^^^^^^^^^^^^^ reference 0.1.test `sg/testspecial`/ ) +//⌄ enclosing_range_start 0.1.test `sg/testspecial_test`/TestFoo_Blackbox(). func TestFoo_Blackbox(*testing.T) { testspecial.Foo() } // ^^^^^^^^^^^^^^^^ definition 0.1.test `sg/testspecial_test`/TestFoo_Blackbox(). // documentation @@ -21,4 +22,5 @@ // ^ reference github.com/golang/go/src go1.22 testing/T# // ^^^^^^^^^^^ reference 0.1.test `sg/testspecial`/ // ^^^ reference 0.1.test `sg/testspecial`/Foo(). +// ⌃ enclosing_range_end 0.1.test `sg/testspecial_test`/TestFoo_Blackbox(). diff --git a/internal/testdata/snapshots/output/testspecial/foo_test.go b/internal/testdata/snapshots/output/testspecial/foo_test.go index 98f6eda..a29ecb6 100755 --- a/internal/testdata/snapshots/output/testspecial/foo_test.go +++ b/internal/testdata/snapshots/output/testspecial/foo_test.go @@ -1,6 +1,7 @@ package testspecial // ^^^^^^^^^^^ reference 0.1.test `sg/testspecial`/ +//⌄ enclosing_range_start 0.1.test `sg/testspecial`/TestFoo_Whitebox(). func TestFoo_Whitebox() { Foo() } // ^^^^^^^^^^^^^^^^ definition 0.1.test `sg/testspecial`/TestFoo_Whitebox(). // documentation @@ -8,4 +9,5 @@ // > func TestFoo_Whitebox() // > ``` // ^^^ reference 0.1.test `sg/testspecial`/Foo(). +// ⌃ enclosing_range_end 0.1.test `sg/testspecial`/TestFoo_Whitebox(). diff --git a/internal/visitors/visitor_file.go b/internal/visitors/visitor_file.go index 930df9e..cae3940 100644 --- a/internal/visitors/visitor_file.go +++ b/internal/visitors/visitor_file.go @@ -30,6 +30,7 @@ func NewFileVisitor( pkgLookup loader.PackageLookup, pkgSymbols *lookup.Package, globalSymbols *lookup.Global, + enclosingNodeMap map[*ast.Ident]ast.Node, ) *fileVisitor { caseClauses := map[token.Pos]types.Object{} for implicit, obj := range pkg.TypesInfo.Implicits { @@ -59,6 +60,7 @@ func NewFileVisitor( caseClauses: caseClauses, pkgNameOverride: map[newtypes.PackageID]string{}, }, + enclosingNodeMap: enclosingNodeMap, } } @@ -98,6 +100,10 @@ type fileVisitor struct { // if ImportSpec.Name is not nil. Otherwise, just use package directly pkgNameOverride map[newtypes.PackageID]string } + + // enclosingNodeMap maps certain nodes to their enclosing nodes for + // enclosing range computation. + enclosingNodeMap map[*ast.Ident]ast.Node } // Implements ast.Visitor @@ -137,7 +143,7 @@ func (v *fileVisitor) Visit(n ast.Node) ast.Visitor { symName := v.createNewLocalSymbol(node.Name.Pos(), pkgAlias) rangeFromName := symbols.RangeFromName( v.pkg.Fset.Position(node.Name.Pos()), node.Name.Name, false) - v.NewDefinition(symName, rangeFromName) + v.NewDefinition(symName, rangeFromName, nil) // Save package name override, so that we use the new local symbol // within this file @@ -157,8 +163,8 @@ func (v *fileVisitor) Visit(n ast.Node) ast.Visitor { // compared to almost every other construct in the language. switch sel := use.(type) { case *types.PkgName: - pos := ident.NamePos - position := v.pkg.Fset.Position(pos) + startPosition := v.pkg.Fset.Position(ident.Pos()) + endPosition := v.pkg.Fset.Position(ident.End()) pkgID := newtypes.GetFromTypesPackage(sel.Imported()) var symbolName string @@ -174,7 +180,7 @@ func (v *fileVisitor) Visit(n ast.Node) ast.Visitor { symbolName = symbol.Symbol } - v.AppendSymbolReference(symbolName, scipRange(position, sel), nil) + v.AppendSymbolReference(symbolName, scipRange(startPosition, endPosition, sel), nil) // Then walk the selection ast.Walk(v, node.Sel) @@ -201,13 +207,13 @@ func (v *fileVisitor) Visit(n ast.Node) ast.Visitor { return nil } - pos := node.NamePos - position := v.pkg.Fset.Position(pos) + startPosition := v.pkg.Fset.Position(node.Pos()) + endPosition := v.pkg.Fset.Position(node.End()) // Short circuit on case clauses if obj, ok := v.overrides.caseClauses[node.Pos()]; ok { symName := v.createNewLocalSymbol(obj.Pos(), obj) - v.NewDefinition(symName, scipRange(position, obj)) + v.NewDefinition(symName, scipRange(startPosition, endPosition, obj), nil) return nil } @@ -225,7 +231,7 @@ func (v *fileVisitor) Visit(n ast.Node) ast.Visitor { symName = v.createNewLocalSymbol(def.Pos(), def) } - v.NewDefinition(symName, scipRange(position, def)) + v.NewDefinition(symName, scipRange(startPosition, endPosition, def), v.enclosingRange(node)) } // Emit Reference @@ -276,7 +282,7 @@ func (v *fileVisitor) Visit(n ast.Node) ast.Visitor { symbol = symInfo.Symbol } - v.AppendSymbolReference(symbol, scipRange(position, ref), overrideType) + v.AppendSymbolReference(symbol, scipRange(startPosition, endPosition, ref), overrideType) } if def == nil && ref == nil { @@ -314,11 +320,12 @@ func (v *fileVisitor) emitImportReference( // NewDefinition emits a scip.Occurence ONLY. This will not emit a // new symbol. You must do that using DeclareNewSymbol[ForPos] -func (v *fileVisitor) NewDefinition(symbol string, rng []int32) { +func (v *fileVisitor) NewDefinition(symbol string, rng []int32, enclRng []int32) { v.occurrences = append(v.occurrences, &scip.Occurrence{ - Range: rng, - Symbol: symbol, - SymbolRoles: symbolDefinition, + Range: rng, + Symbol: symbol, + SymbolRoles: symbolDefinition, + EnclosingRange: enclRng, }) } @@ -371,3 +378,31 @@ func (v *fileVisitor) ToScipDocument() *scip.Document { Symbols: documentSymbols, } } + +func (v *fileVisitor) enclosingRange(n *ast.Ident) []int32 { + if n == nil { + return nil + } + + enclosingNode, ok := v.enclosingNodeMap[n] + if !ok { + return nil + } + + startPosition := v.pkg.Fset.Position(enclosingNode.Pos()) + endPosition := v.pkg.Fset.Position(enclosingNode.End()) + return scipRange(startPosition, endPosition, v.pkg.TypesInfo.Defs[n]) +} + +// EnclosingNodeMap builds a map from [ast.Ident] to its enclosing node for enclosing range computation. +// Currently only supports mapping [ast.Ident] to its enclosing [ast.FuncDecl]. +func EnclosingNodeMap(root ast.Node, enclNodes map[*ast.Ident]ast.Node) { + ast.PreorderStack(root, nil, func(n ast.Node, stack []ast.Node) bool { + if ident, ok := n.(*ast.Ident); ok && len(stack) > 1 { + if funcDecl, ok := stack[len(stack)-1].(*ast.FuncDecl); ok { + enclNodes[ident] = funcDecl + } + } + return true + }) +} diff --git a/internal/visitors/visitors.go b/internal/visitors/visitors.go index b48e58e..2fd0df6 100644 --- a/internal/visitors/visitors.go +++ b/internal/visitors/visitors.go @@ -94,17 +94,20 @@ func descriptorTerm(name string) *scip.Descriptor { } } -func scipRange(position token.Position, obj types.Object) []int32 { +func scipRange(start, end token.Position, obj types.Object) []int32 { var adjustment int32 = 0 if pkgName, ok := obj.(*types.PkgName); ok && strings.HasPrefix(pkgName.Name(), `"`) { adjustment = 1 } - line := int32(position.Line - 1) - column := int32(position.Column - 1) - n := int32(len(obj.Name())) - - return []int32{line, column + adjustment, column + n - adjustment} + startLine := int32(start.Line - 1) + startColumn := int32(start.Column - 1) + endLine := int32(end.Line - 1) + endColumn := int32(end.Column - 1) + if startLine != endLine { + return []int32{startLine, startColumn + adjustment, endLine, endColumn - adjustment} + } + return []int32{startLine, startColumn + adjustment, endColumn - adjustment} } func getIdentOfTypeExpr(pkg *packages.Package, ty ast.Expr) []*ast.Ident {