Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F131246
lsp-workspace-symbols.lua
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
lsp-workspace-symbols.lua
View Options
local
window
=
require
"ivy.window"
local
utils
=
require
"ivy.utils"
local
previous_results
=
{}
local
function
set_items
(
items
)
window
.
set_items
(
items
)
previous_results
=
items
end
local
function
items
(
input
)
local
buffer_number
=
window
.
origin_buffer
local
cwd
=
vim
.
fn
.
getcwd
()
local
results
=
{}
vim
.
lsp
.
buf_request
(
buffer_number
,
"workspace/symbol"
,
{
query
=
input
},
function
(
err
,
server_result
,
_
,
_
)
if
err
~=
nil
then
set_items
{
content
=
"-- There was an error with workspace/symbol --"
}
return
end
local
locations
=
vim
.
lsp
.
util
.
symbols_to_items
(
server_result
or
{},
buffer_number
)
or
{}
for
index
=
1
,
#
locations
do
local
item
=
locations
[
index
]
local
relative_path
=
item
.
filename
:
sub
(
#
cwd
+
2
,
-
1
)
table.insert
(
results
,
{
content
=
relative_path
..
":"
..
item
.
lnum
..
": "
..
item
.
text
})
end
set_items
(
results
)
end
)
return
previous_results
end
local
lsp_workspace_symbols
=
{
name
=
"WorkspaceSymbols"
,
command
=
"IvyWorkspaceSymbols"
,
description
=
"Search for workspace symbols using the lsp workspace/symbol"
,
items
=
items
,
callback
=
utils
.
vimgrep_action
(),
}
return
lsp_workspace_symbols
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Apr 6 2026, 5:23 PM (5 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10568
Default Alt Text
lsp-workspace-symbols.lua (1 KB)
Attached To
Mode
R1 ivy.nvim
Attached
Detach File
Event Timeline
Log In to Comment