Skip to main content

BuiltinServer

Enum BuiltinServer 

Source
#[non_exhaustive]
pub enum BuiltinServer { RustAnalyzer, Pyright, TypescriptLanguageServer, Gopls, Clangd, Zls, }
Expand description

Language servers mcpls ships a default configuration for.

Single source of truth for each builtin’s executable name (Self::as_str) and its install hint, so spawn-failure guidance cannot drift from the defaults.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

RustAnalyzer

rust-analyzer for Rust.

§

Pyright

pyright for Python.

§

TypescriptLanguageServer

typescript-language-server for TypeScript.

§

Gopls

gopls for Go.

§

Clangd

clangd for C and C++.

§

Zls

zls for Zig.

Implementations§

Source§

impl BuiltinServer

Source

pub const ALL: [Self; 6]

Every variant, in declaration order.

Source

pub const fn as_str(self) -> &'static str

The spelling as written on the wire or a command line.

Source§

impl BuiltinServer

Source

pub const fn workspace_code(self) -> &'static str

The workspace-supplied code this server can run, for the message that explains why untrusted mode refused it.

Source

pub const fn install_hint(self) -> &'static str

One-line instruction for installing this server.

Source

pub const fn early_exit_hint(self) -> Option<&'static str>

Likely cause of this server exiting before completing the initialize handshake, if one is known.

Only rust-analyzer has one: rustup installs a rust-analyzer proxy even when the component is not installed, and the proxy exits at once.

Source

pub const fn is_npm_package(self) -> bool

Whether this server is distributed through npm, and so is installed as a .cmd shim on Windows.

Source

pub fn matches_command(self, command: &str) -> bool

Whether command launches this builtin: its file stem is this server’s executable name, so an absolute path or a Windows .cmd shim matches. Case-insensitive on Windows.

§Examples
use mcpls_core::config::BuiltinServer;

let tsls = BuiltinServer::TypescriptLanguageServer;
assert!(tsls.matches_command("typescript-language-server"));
assert!(tsls.matches_command("/usr/local/bin/typescript-language-server"));
assert!(tsls.matches_command("typescript-language-server.cmd"));
assert!(!tsls.matches_command("tsc"));
Source

pub fn from_command(command: &str) -> Option<Self>

Look up a builtin by its exact executable name.

§Examples
use mcpls_core::config::BuiltinServer;

assert_eq!(BuiltinServer::from_command("gopls"), Some(BuiltinServer::Gopls));
assert_eq!(BuiltinServer::from_command("/usr/bin/gopls"), None);

Trait Implementations§

Source§

impl Clone for BuiltinServer

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BuiltinServer

Source§

impl Debug for BuiltinServer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for BuiltinServer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for BuiltinServer

Source§

impl PartialEq for BuiltinServer

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BuiltinServer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more