forked from extern/nushell
Send LSP Completion Item Kind (#11443)
# Description This commit fills in the completion item kind into the `textDocument/completion` response so that LSP client can present more information to the user. It is an improvement in the context of #10794 # User-Facing Changes Improved information display in editor's intelli-sense menu 
This commit is contained in:
@ -2,7 +2,7 @@ use crate::{ast::Call, Alias, BlockId, Example, IoStream, PipelineData, ShellErr
|
||||
|
||||
use super::{EngineState, Stack, StateWorkingSet};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum CommandType {
|
||||
Builtin,
|
||||
Custom,
|
||||
|
@ -4,7 +4,8 @@ use lru::LruCache;
|
||||
use super::cached_file::CachedFile;
|
||||
use super::{usage::build_usage, usage::Usage, StateDelta};
|
||||
use super::{
|
||||
Command, EnvVars, OverlayFrame, ScopeFrame, Stack, Variable, Visibility, DEFAULT_OVERLAY_NAME,
|
||||
Command, CommandType, EnvVars, OverlayFrame, ScopeFrame, Stack, Variable, Visibility,
|
||||
DEFAULT_OVERLAY_NAME,
|
||||
};
|
||||
use crate::ast::Block;
|
||||
use crate::debugger::{Debugger, NoopDebugger};
|
||||
@ -733,7 +734,7 @@ impl EngineState {
|
||||
&self,
|
||||
predicate: impl Fn(&[u8]) -> bool,
|
||||
ignore_deprecated: bool,
|
||||
) -> Vec<(Vec<u8>, Option<String>)> {
|
||||
) -> Vec<(Vec<u8>, Option<String>, CommandType)> {
|
||||
let mut output = vec![];
|
||||
|
||||
for overlay_frame in self.active_overlays(&[]).rev() {
|
||||
@ -743,7 +744,11 @@ impl EngineState {
|
||||
if ignore_deprecated && command.signature().category == Category::Removed {
|
||||
continue;
|
||||
}
|
||||
output.push((decl.0.clone(), Some(command.usage().to_string())));
|
||||
output.push((
|
||||
decl.0.clone(),
|
||||
Some(command.usage().to_string()),
|
||||
command.command_type(),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
use super::cached_file::CachedFile;
|
||||
use super::CommandType;
|
||||
use super::{
|
||||
usage::build_usage, Command, EngineState, OverlayFrame, StateDelta, Variable, VirtualPath,
|
||||
Visibility, PWD_ENV,
|
||||
@ -708,7 +709,7 @@ impl<'a> StateWorkingSet<'a> {
|
||||
&self,
|
||||
predicate: impl Fn(&[u8]) -> bool,
|
||||
ignore_deprecated: bool,
|
||||
) -> Vec<(Vec<u8>, Option<String>)> {
|
||||
) -> Vec<(Vec<u8>, Option<String>, CommandType)> {
|
||||
let mut output = vec![];
|
||||
|
||||
for scope_frame in self.delta.scope.iter().rev() {
|
||||
@ -721,7 +722,11 @@ impl<'a> StateWorkingSet<'a> {
|
||||
if ignore_deprecated && command.signature().category == Category::Removed {
|
||||
continue;
|
||||
}
|
||||
output.push((decl.0.clone(), Some(command.usage().to_string())));
|
||||
output.push((
|
||||
decl.0.clone(),
|
||||
Some(command.usage().to_string()),
|
||||
command.command_type(),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user