repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/diagnostic/qualify.rs | sway-lsp/src/capabilities/code_actions/diagnostic/qualify.rs | use super::auto_import::get_call_paths_for_name;
use crate::capabilities::{
code_actions::{CodeActionContext, CODE_ACTION_QUALIFY_TITLE},
diagnostic::DiagnosticData,
};
use lsp_types::{
CodeAction as LspCodeAction, CodeActionKind, CodeActionOrCommand, Range, TextEdit,
WorkspaceEdit,
};
use serde_json::V... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/diagnostic/mod.rs | sway-lsp/src/capabilities/code_actions/diagnostic/mod.rs | mod auto_import;
mod qualify;
use crate::capabilities::{code_actions::CodeActionContext, diagnostic::DiagnosticData};
use lsp_types::CodeActionOrCommand;
use self::auto_import::import_code_action;
use self::qualify::qualify_code_action;
/// Returns a list of [CodeActionOrCommand] based on the relevant compiler diagn... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/diagnostic/auto_import.rs | sway-lsp/src/capabilities/code_actions/diagnostic/auto_import.rs | use crate::{
capabilities::{
code_actions::{CodeActionContext, CODE_ACTION_IMPORT_TITLE},
diagnostic::DiagnosticData,
},
core::token::{get_range_from_span, ParsedAstToken, SymbolKind, TypedAstToken},
};
use lsp_types::{
CodeAction as LspCodeAction, CodeActionKind, CodeActionOrCommand, Po... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/common/generate_doc.rs | sway-lsp/src/capabilities/code_actions/common/generate_doc.rs | use crate::capabilities::code_actions::CodeAction;
use sway_core::{Engines, TypeId};
use sway_types::Spanned;
pub(crate) trait GenerateDocCodeAction<'a, T: Spanned>: CodeAction<'a, T> {
/// Returns a placeholder description as a vector of strings.
fn description_section(&self) -> Vec<String> {
vec!["Ad... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/common/basic_doc_comment.rs | sway-lsp/src/capabilities/code_actions/common/basic_doc_comment.rs | use crate::capabilities::code_actions::{CodeAction, CodeActionContext, CODE_ACTION_DOC_TITLE};
use lsp_types::{Range, Url};
use sway_types::Spanned;
use super::generate_doc::GenerateDocCodeAction;
pub struct BasicDocCommentCodeAction<'a, T: Spanned> {
decl: &'a T,
uri: &'a Url,
}
impl<'a, T: Spanned> Generat... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/common/mod.rs | sway-lsp/src/capabilities/code_actions/common/mod.rs | pub mod basic_doc_comment;
pub mod fn_doc_comment;
pub mod generate_doc;
pub mod generate_impl;
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/common/fn_doc_comment.rs | sway-lsp/src/capabilities/code_actions/common/fn_doc_comment.rs | use crate::capabilities::code_actions::{CodeAction, CodeActionContext, CODE_ACTION_DOC_TITLE};
use lsp_types::{Range, Url};
use sway_core::{language::ty::FunctionSignature, Engines};
use sway_types::{Named, Spanned};
use super::generate_doc::GenerateDocCodeAction;
pub struct FnDocCommentCodeAction<'a, T: Spanned + Na... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/common/generate_impl.rs | sway-lsp/src/capabilities/code_actions/common/generate_impl.rs | use sway_core::{
transform::{AttributeKind, Attributes},
TypeParameter,
};
use sway_types::{Named, Spanned};
use crate::capabilities::code_actions::CodeAction;
pub(crate) const CONTRACT: &str = "Contract";
pub(crate) const TAB: &str = " ";
pub(crate) trait GenerateImplCodeAction<'a, T: Spanned>: CodeActio... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/constant_decl/mod.rs | sway-lsp/src/capabilities/code_actions/constant_decl/mod.rs | use crate::capabilities::code_actions::{CodeAction, CodeActionContext};
use lsp_types::CodeActionOrCommand;
use sway_core::language::ty;
use super::common::basic_doc_comment::BasicDocCommentCodeAction;
pub(crate) fn code_actions(
decl: &ty::TyConstantDecl,
ctx: &CodeActionContext,
) -> Vec<CodeActionOrCommand... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/enum_decl/enum_impl.rs | sway-lsp/src/capabilities/code_actions/enum_decl/enum_impl.rs | use crate::capabilities::code_actions::{
common::generate_impl::{GenerateImplCodeAction, TAB},
CodeAction, CodeActionContext, CODE_ACTION_IMPL_TITLE,
};
use lsp_types::{Range, Url};
use sway_core::language::ty::TyEnumDecl;
pub(crate) struct EnumImplCodeAction<'a> {
decl: &'a TyEnumDecl,
uri: &'a Url,
}... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/enum_decl/mod.rs | sway-lsp/src/capabilities/code_actions/enum_decl/mod.rs | pub(crate) mod enum_impl;
use self::enum_impl::EnumImplCodeAction;
use crate::capabilities::code_actions::{CodeAction, CodeActionContext};
use lsp_types::CodeActionOrCommand;
use sway_core::{decl_engine::id::DeclId, language::ty};
use super::common::basic_doc_comment::BasicDocCommentCodeAction;
pub(crate) fn code_ac... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/abi_decl/abi_impl.rs | sway-lsp/src/capabilities/code_actions/abi_decl/abi_impl.rs | use crate::capabilities::code_actions::{
common::generate_impl::{GenerateImplCodeAction, CONTRACT},
CodeAction, CodeActionContext, CODE_ACTION_IMPL_TITLE,
};
use lsp_types::{Range, Url};
use sway_core::{
language::ty::{self, TyAbiDecl, TyFunctionParameter, TyTraitFn},
Engines,
};
use sway_types::Spanned... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/abi_decl/mod.rs | sway-lsp/src/capabilities/code_actions/abi_decl/mod.rs | pub(crate) mod abi_impl;
use self::abi_impl::AbiImplCodeAction;
use super::{CodeAction, CodeActionContext};
use lsp_types::CodeActionOrCommand;
use sway_core::{decl_engine::id::DeclId, language::ty::TyAbiDecl};
pub(crate) fn code_actions(
decl_id: &DeclId<TyAbiDecl>,
ctx: &CodeActionContext,
) -> Vec<CodeActi... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/trait_fn/mod.rs | sway-lsp/src/capabilities/code_actions/trait_fn/mod.rs | use crate::capabilities::code_actions::{CodeAction, CodeActionContext};
use lsp_types::CodeActionOrCommand;
use sway_core::language::ty;
use super::common::fn_doc_comment::FnDocCommentCodeAction;
pub(crate) fn code_actions(
decl: &ty::TyTraitFn,
ctx: &CodeActionContext,
) -> Vec<CodeActionOrCommand> {
vec... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/capabilities/code_actions/struct_field/mod.rs | sway-lsp/src/capabilities/code_actions/struct_field/mod.rs | use crate::capabilities::code_actions::{CodeAction, CodeActionContext};
use lsp_types::CodeActionOrCommand;
use sway_core::language::ty;
use super::common::basic_doc_comment::BasicDocCommentCodeAction;
pub(crate) fn code_actions(
decl: &ty::TyStructField,
ctx: &CodeActionContext,
) -> Vec<CodeActionOrCommand>... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/traverse/parsed_tree.rs | sway-lsp/src/traverse/parsed_tree.rs | #![allow(dead_code)]
use crate::{
core::{
token::{
desugared_op, type_info_to_symbol_kind, ParsedAstToken, SymbolKind, Token,
TypeDefinition,
},
token_map::TokenMap,
},
traverse::{adaptive_iter, Parse, ParseContext},
};
use rayon::iter::{IntoParallelRefIterat... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | true |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/traverse/typed_tree.rs | sway-lsp/src/traverse/typed_tree.rs | #![allow(dead_code)]
use crate::{
core::token::{
type_info_to_symbol_kind, SymbolKind, Token, TokenAstNode, TokenIdent, TypeDefinition,
TypedAstToken,
},
traverse::{adaptive_iter, Parse, ParseContext},
};
use dashmap::mapref::one::RefMut;
use rayon::iter::{IndexedParallelIterator, IntoParall... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | true |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/traverse/dependency.rs | sway-lsp/src/traverse/dependency.rs | use crate::{
core::token::{ParsedAstToken, SymbolKind, Token, TokenAstNode, TypeDefinition, TypedAstToken},
traverse::ParseContext,
};
use sway_core::language::{
parsed::{AstNode, AstNodeContent, Declaration},
ty,
};
use sway_types::Named;
/// Insert Declaration tokens into the TokenMap.
pub fn collect... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/traverse/mod.rs | sway-lsp/src/traverse/mod.rs | use crate::core::{token::TokenIdent, token_map::TokenMap};
use rayon_cond::CondIterator;
use sway_core::{namespace::Package, Engines};
pub(crate) mod dependency;
pub(crate) mod lexed_tree;
pub(crate) mod parsed_tree;
pub(crate) mod typed_tree;
pub struct ParseContext<'a> {
tokens: &'a TokenMap,
pub engines: &... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/traverse/lexed_tree.rs | sway-lsp/src/traverse/lexed_tree.rs | use crate::{
core::token::{ParsedAstToken, SymbolKind, Token},
traverse::{adaptive_iter, Parse, ParseContext},
};
use rayon::iter::{ParallelBridge, ParallelIterator};
use sway_ast::{
assignable::ElementAccess, attribute::Annotated, expr::LoopControlFlow, ty::TyTupleDescriptor,
Assignable, CodeBlockConte... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/utils/test.rs | sway-lsp/src/utils/test.rs | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false | |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/utils/markup.rs | sway-lsp/src/utils/markup.rs | //! Markdown formatting.
//!
//! Sometimes, we want to display a "rich text" in the UI. At the moment, we use
//! markdown for this purpose.
//! Modified from rust-analyzer.
use crate::{
capabilities::hover::hover_link_contents::RelatedType, config::LspClient,
core::token::get_range_from_span, utils::document::... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/utils/document.rs | sway-lsp/src/utils/document.rs | use crate::error::DirectoryError;
use lsp_types::Url;
use std::path::PathBuf;
use sway_types::{SourceEngine, Span};
/// Create a [Url] from a [`PathBuf`].
pub fn get_url_from_path(path: &PathBuf) -> Result<Url, DirectoryError> {
Url::from_file_path(path).map_err(|()| DirectoryError::UrlFromPathFailed {
pat... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/utils/keyword_docs.rs | sway-lsp/src/utils/keyword_docs.rs | #![allow(unused)]
use proc_macro2::{TokenStream, TokenTree};
use quote::ToTokens;
use std::{collections::hash_map::HashMap, fmt::Write};
use syn::{parse_quote, ItemMod};
// Ported from https://github.com/rust-lang/rust/blob/master/library/std/src/keyword_docs.rs
/// Documentation for sway keywords.
/// Primarily use... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | true |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/utils/debug.rs | sway-lsp/src/utils/debug.rs | #![allow(dead_code)]
use crate::core::token::{Token, TokenIdent};
use dashmap::mapref::multiple::RefMulti;
use lsp_types::{Diagnostic, DiagnosticSeverity};
use sway_core::{
decl_engine::DeclEngine,
language::{ty, Literal},
};
pub(crate) fn generate_warnings_non_typed_tokens<'s, I>(tokens: I) -> Vec<Diagnostic>... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/utils/markdown.rs | sway-lsp/src/utils/markdown.rs | //! Transforms markdown
const SWAYDOC_FENCES: [&str; 2] = ["```", "~~~"];
/// Transforms markdown and takes care of any code blocks
/// to allow for syntax highlighting.
pub fn format_docs(src: &str) -> String {
let mut processed_lines = Vec::new();
let mut in_code_block = false;
let mut is_sway = false;
... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/utils/mod.rs | sway-lsp/src/utils/mod.rs | pub(crate) mod attributes;
pub mod debug;
pub(crate) mod document;
pub mod keyword_docs;
pub mod markdown;
pub(crate) mod markup;
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/utils/attributes.rs | sway-lsp/src/utils/attributes.rs | #![allow(dead_code)]
use crate::core::token::{ParsedAstToken, Token, TokenAstNode, TypedAstToken};
use sway_core::{
language::{parsed::Declaration, ty},
transform, Engines,
};
/// Gets attributes from typed token, falling back to parsed AST node if needed.
/// Callback can be used to retrieve doc comment attri... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/handlers/notification.rs | sway-lsp/src/handlers/notification.rs | //! This module is responsible for implementing handlers for Language Server
//! Protocol. This module specifically handles notification messages sent by the Client.
use crate::{
core::{document::Documents, session::Session, sync::SyncWorkspace},
error::LanguageServerError,
server_state::{CompilationContex... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/handlers/request.rs | sway-lsp/src/handlers/request.rs | //! This module is responsible for implementing handlers for Language Server
//! Protocol. This module specifically handles requests.
use crate::{
capabilities,
core::session::{self, build_plan, program_id_from_path},
lsp_ext,
server_state::ServerState,
utils::debug,
};
use forc_tracing::{tracing_s... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/core/token_map_ext.rs | sway-lsp/src/core/token_map_ext.rs | //! This module provides the `TokenMapExt` trait, which extends iterators over tokens with
//! additional functionality, such as finding all references of a given token in a TokenMap.
//!
//! The `TokenMapExt` trait is implemented for any iterator that yields (Ident, Token) pairs.
use crate::core::token::{Token, Token... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/core/session.rs | sway-lsp/src/core/session.rs | use crate::{
capabilities::{
self,
diagnostic::DiagnosticMap,
runnable::{Runnable, RunnableMainFn, RunnableTestFn},
},
core::{
sync::SyncWorkspace,
token::{self, TypedAstToken},
token_map::{TokenMap, TokenMapExt},
},
error::{DirectoryError, DocumentErr... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/core/document.rs | sway-lsp/src/core/document.rs | use std::{path::PathBuf, sync::Arc};
use crate::{
error::{DirectoryError, DocumentError, LanguageServerError},
utils::document,
};
use dashmap::DashMap;
use forc_util::fs_locking::PidFileLocking;
use lsp_types::{Position, Range, TextDocumentContentChangeEvent, Url};
use sway_utils::get_sway_files;
use tokio::{... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/core/sync.rs | sway-lsp/src/core/sync.rs | use crate::{
error::{DirectoryError, DocumentError, LanguageServerError},
utils::document::{get_path_from_url, get_url_from_path, get_url_from_span},
};
use dashmap::DashMap;
use forc_pkg::manifest::{GenericManifestFile, ManifestFile};
use lsp_types::Url;
use std::{
fs,
path::{Path, PathBuf},
};
use swa... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/core/token_map.rs | sway-lsp/src/core/token_map.rs | use crate::core::token::{self, Token, TokenIdent, TypedAstToken};
use dashmap::{
mapref::{
multiple::RefMulti,
one::{Ref, RefMut},
},
try_result::TryResult,
DashMap,
};
use lsp_types::{Position, Url};
use std::{path::PathBuf, thread, time::Duration};
use sway_core::{engine_threading::Spa... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/core/mod.rs | sway-lsp/src/core/mod.rs | pub mod document;
pub mod session;
pub mod sync;
pub(crate) mod token;
pub mod token_map;
pub mod token_map_ext;
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/src/core/token.rs | sway-lsp/src/core/token.rs | use lsp_types::{Position, Range};
use std::path::PathBuf;
use sway_ast::Intrinsic;
use sway_core::{
decl_engine::parsed_id::ParsedDeclId,
language::{
parsed::{
AbiCastExpression, AmbiguousPathExpression, Declaration, DelineatedPathExpression,
EnumVariant, Expression, FunctionAppl... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/tests/lib.rs | sway-lsp/tests/lib.rs | #![recursion_limit = "256"]
pub mod integration;
use crate::integration::{code_actions, lsp};
use forc_pkg::manifest::{GenericManifestFile, ManifestFile};
use lsp_types::*;
use rayon::prelude::*;
use std::{
fs, panic,
path::PathBuf,
process::{Command, Stdio},
sync::Mutex,
};
use sway_lsp::{
config... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | true |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/tests/integration/code_actions.rs | sway-lsp/tests/integration/code_actions.rs | //! This file contains methods used for simulating LSP code action json-rpc notifications and requests.
//! The methods are used to build and send requests and notifications to the LSP service
//! and assert the expected responses.
use lsp_types::*;
use pretty_assertions::assert_eq;
use serde_json::json;
use std::coll... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/tests/integration/lsp.rs | sway-lsp/tests/integration/lsp.rs | //! This file contains the methods used for simulating LSP json-rpc notifications and requests.
//! The methods are used to build and send requests and notifications to the LSP service
//! and assert the expected responses.
use crate::{GotoDefinition, HoverDocumentation, Rename};
use assert_json_diff::assert_json_eq;
... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/tests/integration/mod.rs | sway-lsp/tests/integration/mod.rs | pub(crate) mod code_actions;
pub(crate) mod lsp;
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/tests/utils/src/lib.rs | sway-lsp/tests/utils/src/lib.rs | use assert_json_diff::assert_json_include;
use futures::StreamExt;
use lsp_types::Url;
use rand::{rngs::SmallRng, Rng, SeedableRng};
use serde_json::Value;
use std::{
env, fs,
io::Read,
path::{Path, PathBuf},
};
use tokio::task::JoinHandle;
use tower_lsp::ClientSocket;
pub fn load_sway_example(src_path: Pa... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/benches/bench_main.rs | sway-lsp/benches/bench_main.rs | #![recursion_limit = "256"]
mod lsp_benchmarks;
use codspeed_criterion_compat::criterion_main;
// Use Jemalloc during benchmarks
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
criterion_main! {
lsp_benchmarks::token_map::benches,
lsp_benchmarks::requests::benche... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/benches/lsp_benchmarks/compile.rs | sway-lsp/benches/lsp_benchmarks/compile.rs | use codspeed_criterion_compat::{black_box, criterion_group, Criterion};
use forc_pkg::manifest::{GenericManifestFile, ManifestFile};
use lsp_types::Url;
use parking_lot::RwLock;
use std::sync::Arc;
use sway_core::Engines;
use sway_lsp::core::session;
use tokio::runtime::Runtime;
const NUM_DID_CHANGE_ITERATIONS: usize ... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/benches/lsp_benchmarks/token_map.rs | sway-lsp/benches/lsp_benchmarks/token_map.rs | use codspeed_criterion_compat::{black_box, criterion_group, Criterion};
use lsp_types::Position;
use tokio::runtime::Runtime;
fn benchmarks(c: &mut Criterion) {
let (uri, _, state, engines, sync) = Runtime::new()
.unwrap()
.block_on(async { black_box(super::compile_test_project().await) });
let... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/benches/lsp_benchmarks/mod.rs | sway-lsp/benches/lsp_benchmarks/mod.rs | pub mod compile;
pub mod requests;
pub mod token_map;
use lsp_types::Url;
use std::{path::PathBuf, sync::Arc};
use sway_core::{Engines, LspConfig};
use sway_lsp::{
config::GarbageCollectionConfig,
core::{
session::{self, Session},
sync::SyncWorkspace,
},
server_state::{CompilationContex... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-lsp/benches/lsp_benchmarks/requests.rs | sway-lsp/benches/lsp_benchmarks/requests.rs | use codspeed_criterion_compat::{black_box, criterion_group, Criterion};
use lsp_types::{
CompletionResponse, DocumentSymbolResponse, Position, Range, TextDocumentContentChangeEvent,
TextDocumentIdentifier,
};
use sway_lsp::{capabilities, core::session, lsp_ext::OnEnterParams};
use tokio::runtime::Runtime;
fn b... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-types/src/ast.rs | sway-types/src/ast.rs | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Delimiter {
Parenthesis,
Brace,
Bracket,
}
impl Delimiter {
pub const fn as_open_char(self) -> char {
match self {
Delimiter::Parenthesis => '(',
Delimiter::Brace => '{',
Delimiter::... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-types/src/lib.rs | sway-types/src/lib.rs | use fuel_asm::Word;
use fuel_crypto::Hasher;
use fuel_tx::{Bytes32, ContractId};
use serde::{Deserialize, Serialize};
use std::hash::Hash;
use std::path::{Path, PathBuf};
use std::{io, iter, slice};
pub mod constants;
pub mod ident;
pub mod u256;
pub use ident::*;
pub mod integer_bits;
pub mod source_engine;
pub us... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-types/src/integer_bits.rs | sway-types/src/integer_bits.rs | use std::fmt;
#[derive(Eq, PartialEq, Hash, Debug, Clone, Copy, PartialOrd, Ord)]
pub enum IntegerBits {
Eight,
Sixteen,
ThirtyTwo,
SixtyFour,
V256,
}
impl IntegerBits {
/// Returns if `v` would overflow using `self` bits or not.
pub fn would_overflow(&self, v: u64) -> bool {
if v ... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-types/src/u256.rs | sway-types/src/u256.rs | use num_bigint::{BigUint, ParseBigIntError, TryFromBigIntError};
use num_traits::Zero;
use serde::{Deserialize, Serialize};
use std::ops::{Not, Shl, Shr};
use thiserror::Error;
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Serialize, Deserialize)]
pub struct U256(BigUint);
impl U256 {
pub fn from_b... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-types/src/ident.rs | sway-types/src/ident.rs | use crate::{span::Span, Spanned};
use serde::{Deserialize, Serialize};
use std::{
borrow::Cow,
cmp::{Ord, Ordering},
fmt,
hash::{Hash, Hasher},
sync::Arc,
};
pub trait Named {
fn name(&self) -> &BaseIdent;
}
#[derive(Clone, Serialize, Deserialize)]
pub struct BaseIdent {
name_override_opt:... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-types/src/source_engine.rs | sway-types/src/source_engine.rs | use crate::{span, LineCol, ProgramId, SourceId, Span};
use parking_lot::RwLock;
use std::{
collections::{BTreeSet, HashMap},
path::{Path, PathBuf},
str::FromStr,
};
use toml::Table;
/// The Source Engine manages a relationship between file paths and their corresponding
/// integer-based source IDs. Additio... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-types/src/span.rs | sway-types/src/span.rs | use crate::SourceId;
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use std::{
cmp,
fmt::{self, Display},
hash::Hash,
sync::Arc,
};
lazy_static! {
static ref DUMMY_SPAN: Span = Span::new(
Source {
text: Arc::from(""),
line_starts: Arc::new(vec![])... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-types/src/style.rs | sway-types/src/style.rs | /// Find the first index in the string which separates a lowercase character from an uppercase
/// character. Used for splitting words in a CamelCase style identifier.
fn find_camel_case_word_boundary(name: &str) -> Option<usize> {
let mut previous_char_was_lowercase = false;
for (index, c) in name.char_indices... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-types/src/constants.rs | sway-types/src/constants.rs | //! Configurable yet non-changing constants for the compiler.
/// The default extension of [LANGUAGE_NAME] files, e.g. `main.sw`.
pub const DEFAULT_FILE_EXTENSION: &str = "sw";
/// After a large language name change PR, we decided to make this configurable. :)
pub const LANGUAGE_NAME: &str = "Sway";
/// The size, in b... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/reduced_std_libs.rs | test/src/reduced_std_libs.rs | //! This module contains functions for creating reduced versions of the `std` library.
use anyhow::{bail, Context, Ok, Result};
use core::result::Result::Ok as CoreOk;
use std::{
fs,
path::{Path, PathBuf},
};
pub(crate) const REDUCED_STD_LIBS_DIR_NAME: &str = "reduced_std_libs";
const REDUCED_LIB_CONFIG_FILE_... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/main.rs | test/src/main.rs | mod e2e_vm_tests;
mod ir_generation;
mod reduced_std_libs;
mod snapshot;
mod test_consistency;
use anyhow::Result;
use clap::Parser;
use forc::cli::shared::{IrCliOpt, PrintAsmCliOpt};
use forc_test::GasCostsSource;
use forc_tracing::init_tracing_subscriber;
use fuel_vm::prelude::GasCostsValues;
use std::str::FromStr;
... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/test_consistency.rs | test/src/test_consistency.rs | //! This module contains checks that ensure consistency of the tests.
use anyhow::{anyhow, bail, Context, Ok, Result};
use std::path::{Path, PathBuf};
use toml::{Table, Value};
use crate::reduced_std_libs::REDUCED_STD_LIBS_DIR_NAME;
pub(crate) fn check() -> Result<()> {
let manifest_dir = env!("CARGO_MANIFEST_DI... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/ir_generation/mod.rs | test/src/ir_generation/mod.rs | use std::{
fs,
ops::Not,
path::{Path, PathBuf},
};
use anyhow::Result;
use colored::Colorize;
use sway_core::{
compile_ir_context_to_finalized_asm, compile_to_ast,
ir_generation::compile_program,
namespace::{self, Package},
BuildConfig, BuildTarget, Engines, OptLevel, PanicOccurrences, Pani... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/harness.rs | test/src/sdk-harness/test_projects/harness.rs | // Add test modules here:
mod abi_impl_methods_callable;
mod asset_id;
mod asset_ops;
mod auth;
mod block;
mod call_frames;
mod configurables_in_contract;
mod configurables_in_script;
mod context;
mod contract_bytecode;
mod ec_recover;
mod ec_recover_and_match_predicate;
mod events;
mod evm;
mod evm_ec_recover;
mod ex... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/evm/mod.rs | test/src/sdk-harness/test_projects/evm/mod.rs | use fuels::{
prelude::*,
types::{Bits256, ContractId, EvmAddress},
};
abigen!(Contract(
name = "EvmTestContract",
abi = "test_projects/evm/out/release/evm-abi.json"
));
async fn get_evm_test_instance() -> (EvmTestContract<Wallet>, ContractId) {
let wallet = launch_provider_and_get_wallet().await.u... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage/mod.rs | test/src/sdk-harness/test_projects/storage/mod.rs | use fuels::{
prelude::*,
types::{Bits256, SizedAsciiString},
};
abigen!(Contract(
name = "TestStorageContract",
abi = "test_projects/storage/out/release/storage-abi.json",
));
async fn get_test_storage_instance() -> TestStorageContract<Wallet> {
let wallet = launch_provider_and_get_wallet().await.... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_map_nested/mod.rs | test/src/sdk-harness/test_projects/storage_map_nested/mod.rs | use fuels::prelude::*;
abigen!(Contract(
name = "TestStorageMapNestedContract",
abi = "test_projects/storage_map_nested/out/release/storage_map_nested-abi.json",
));
async fn test_storage_map_nested_instance() -> TestStorageMapNestedContract<Wallet> {
let wallet = launch_provider_and_get_wallet().await.un... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/auth/mod.rs | test/src/sdk-harness/test_projects/auth/mod.rs | use fuels::{
accounts::{predicate::Predicate, signers::private_key::PrivateKeySigner},
prelude::*,
tx::UtxoId,
types::{
coin::{Coin},
coin_type::CoinType,
input::Input,
message::{Message, MessageStatus},
Bytes32, ContractId,
},
};
use std::str::FromStr;
abige... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/run_external_proxy/mod.rs | test/src/sdk-harness/test_projects/run_external_proxy/mod.rs | use fuels::{prelude::*, types::Bits256};
abigen!(Contract(
name = "RunExternalProxyContract",
abi = "test_projects/run_external_proxy/out/release/run_external_proxy-abi.json",
));
#[tokio::test]
async fn run_external_can_proxy_call() {
let wallet = launch_provider_and_get_wallet().await.unwrap();
let... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/run_external_proxy_with_storage/mod.rs | test/src/sdk-harness/test_projects/run_external_proxy_with_storage/mod.rs | use fuels::{prelude::*, types::Bits256};
abigen!(Contract(
name = "RunExternalProxyContract",
abi = "test_projects/run_external_proxy_with_storage/out/release/run_external_proxy_with_storage-abi.json",
));
#[tokio::test]
async fn run_external_can_proxy_call() {
let wallet = launch_provider_and_get_wallet(... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/testgen.rs | test/src/sdk-harness/test_projects/storage_vec/testgen.rs | #[macro_export]
macro_rules! testgen {
(
// Name of the module to create.
$module_name:ident,
// Path to the contract ABI (string literal required for `abigen!`).
$abi_path:expr,
// Type to test, as a string literal (required for binary and storage file names).
$type_... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/svec_u32.rs | test/src/sdk-harness/test_projects/storage_vec/svec_u32.rs | testgen!(
test_u32_vec,
"test_artifacts/storage_vec/svec_u32/out/release/svec_u32-abi.json",
"u32",
u32,
1u32,
2u32,
3u32,
4u32,
5u32
);
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/svec_u64.rs | test/src/sdk-harness/test_projects/storage_vec/svec_u64.rs | testgen!(
test_u64_vec,
"test_artifacts/storage_vec/svec_u64/out/release/svec_u64-abi.json",
"u64",
u64,
1u64,
2u64,
3u64,
4u64,
5u64
);
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/svec_u16.rs | test/src/sdk-harness/test_projects/storage_vec/svec_u16.rs | testgen!(
test_u16_vec,
"test_artifacts/storage_vec/svec_u16/out/release/svec_u16-abi.json",
"u16",
u16,
1u16,
2u16,
3u16,
4u16,
5u16
);
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/svec_b256.rs | test/src/sdk-harness/test_projects/storage_vec/svec_b256.rs | testgen!(
test_b256_vec,
"test_artifacts/storage_vec/svec_b256/out/release/svec_b256-abi.json",
"b256",
::fuels::types::Bits256,
::fuels::types::Bits256([1; 32]),
::fuels::types::Bits256([2; 32]),
::fuels::types::Bits256([3; 32]),
::fuels::types::Bits256([4; 32]),
::fuels::types::Bit... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/svec_array.rs | test/src/sdk-harness/test_projects/storage_vec/svec_array.rs | testgen!(
test_array_vec,
"test_artifacts/storage_vec/svec_array/out/release/svec_array-abi.json",
"array",
[u8; 3],
[1; 3],
[2; 3],
[3; 3],
[4; 3],
[5; 3]
);
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/svec_tuple.rs | test/src/sdk-harness/test_projects/storage_vec/svec_tuple.rs | testgen!(
test_tuple_vec,
"test_artifacts/storage_vec/svec_tuple/out/release/svec_tuple-abi.json",
"tuple",
(u8, u8, u8),
(1, 1, 1),
(2, 2, 2),
(4, 4, 4),
(5, 5, 5),
(6, 6, 6)
);
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/mod.rs | test/src/sdk-harness/test_projects/storage_vec/mod.rs | #[macro_use]
mod testgen;
mod svec_array;
mod svec_b256;
mod svec_bool;
mod svec_enum;
mod svec_str;
mod svec_struct;
mod svec_tuple;
mod svec_u16;
mod svec_u32;
mod svec_u64;
mod svec_u8;
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/svec_struct.rs | test/src/sdk-harness/test_projects/storage_vec/svec_struct.rs | testgen!(
test_struct_vec,
"test_artifacts/storage_vec/svec_struct/out/release/svec_struct-abi.json",
"struct",
TestStruct,
TestStruct { a: true, b: 1 },
TestStruct { a: false, b: 2 },
TestStruct { a: true, b: 3 },
TestStruct { a: false, b: 4 },
TestStruct { a: true, b: 5 }
);
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/svec_enum.rs | test/src/sdk-harness/test_projects/storage_vec/svec_enum.rs | testgen!(
test_enum_vec,
"test_artifacts/storage_vec/svec_enum/out/release/svec_enum-abi.json",
"enum",
TestEnum,
TestEnum::A(true),
TestEnum::A(false),
TestEnum::B(1),
TestEnum::B(3),
TestEnum::B(2)
);
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/svec_u8.rs | test/src/sdk-harness/test_projects/storage_vec/svec_u8.rs | testgen!(
test_u8_vec,
"test_artifacts/storage_vec/svec_u8/out/release/svec_u8-abi.json",
"u8",
u8,
1u8,
2u8,
3u8,
4u8,
5u8
);
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/svec_str.rs | test/src/sdk-harness/test_projects/storage_vec/svec_str.rs | testgen!(
test_str_vec,
"test_artifacts/storage_vec/svec_str/out/release/svec_str-abi.json",
"str",
::fuels::types::SizedAsciiString::<4>,
::fuels::types::SizedAsciiString::<4>::new("yeet".to_string()).unwrap(),
::fuels::types::SizedAsciiString::<4>::new("meow".to_string()).unwrap(),
::fuels... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec/svec_bool.rs | test/src/sdk-harness/test_projects/storage_vec/svec_bool.rs | testgen!(
test_bool_vec,
"test_artifacts/storage_vec/svec_bool/out/release/svec_bool-abi.json",
"bool",
bool,
true,
true,
false,
true,
false
);
| rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/predicate_data_simple/mod.rs | test/src/sdk-harness/test_projects/predicate_data_simple/mod.rs | use fuel_vm::fuel_asm::{op, RegId};
use fuel_vm::fuel_tx;
use fuel_vm::fuel_tx::{Address, AssetId, Output};
use fuels::{
core::codec::{ABIEncoder, EncoderConfig},
prelude::*,
types::{input::Input, transaction_builders::ScriptTransactionBuilder, Token},
};
use std::str::FromStr;
async fn setup() -> (Vec<u8>... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_map/try_insert.rs | test/src/sdk-harness/test_projects/storage_map/try_insert.rs | use super::*;
#[macro_export]
macro_rules! generate_try_insert_tests {
($input_string:expr, $key:expr, $value1:expr, $value2:expr) => {
paste::paste! {
#[tokio::test]
async fn [<try_insert_ $input_string _exists>]() {
let instance = test_storage_map_instance().await;... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_map/mod.rs | test/src/sdk-harness/test_projects/storage_map/mod.rs | use fuels::{
prelude::*,
types::{Bits256, SizedAsciiString},
};
pub mod try_insert;
abigen!(Contract(
name = "TestStorageMapContract",
abi = "test_projects/storage_map/out/release/storage_map-abi.json",
));
async fn test_storage_map_instance() -> TestStorageMapContract<Wallet> {
let wallet = laun... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | true |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/tx_fields/mod.rs | test/src/sdk-harness/test_projects/tx_fields/mod.rs | use fuel_vm::fuel_crypto::Hasher;
use fuel_vm::fuel_tx::{ContractId, Input as TxInput};
use fuels::core::codec::EncoderConfig;
use fuels::types::transaction_builders::TransactionBuilder;
use fuels::{
accounts::{predicate::Predicate, signers::private_key::PrivateKeySigner},
prelude::*,
tx::StorageSlot,
t... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | true |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/type_aliases/mod.rs | test/src/sdk-harness/test_projects/type_aliases/mod.rs | use fuels::{
prelude::*,
types::{Bits256, Identity, SizedAsciiString},
};
abigen!(Contract(
name = "TypeAliasesTestContract",
abi = "test_projects/type_aliases/out/release/type_aliases-abi.json"
));
async fn get_type_aliases_instance() -> (TypeAliasesTestContract<Wallet>, ContractId) {
let wallet ... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/string_slice/mod.rs | test/src/sdk-harness/test_projects/string_slice/mod.rs | use fuel_vm::fuel_asm::{op, RegId};
use fuel_vm::fuel_tx;
use fuel_vm::fuel_tx::{Address, AssetId, Output};
use fuels::types::StaticStringToken;
use fuels::{
core::codec::{ABIEncoder, EncoderConfig},
prelude::*,
types::{input::Input, transaction_builders::ScriptTransactionBuilder, Token},
};
use std::str::F... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/contract_bytecode/mod.rs | test/src/sdk-harness/test_projects/contract_bytecode/mod.rs | use fuel_vm::fuel_tx::Contract as FuelsTxContract;
use fuels::{prelude::*, types::Bits256};
abigen!(Contract(
name = "ContractBytecodeTest",
abi = "test_projects/contract_bytecode/out/release/contract_bytecode-abi.json"
));
#[tokio::test]
async fn can_get_bytecode_root() {
let wallet = launch_provider_and... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/logging/mod.rs | test/src/sdk-harness/test_projects/logging/mod.rs | use fuels::prelude::*;
#[tokio::test]
async fn run_valid() -> Result<()> {
abigen!(Script(
name = "Logging",
abi = "test_projects/logging/out/release/logging-abi.json",
));
let wallet = launch_provider_and_get_wallet().await.unwrap();
let bin_path = "test_projects/logging/out/release/l... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/script_bytecode/mod.rs | test/src/sdk-harness/test_projects/script_bytecode/mod.rs | use fuel_core::service::{Config, FuelService};
use fuel_core_client::{
client::FuelClient,
fuel_tx::{Bytes32, Receipt, Transaction},
};
use fuel_crypto::Hasher;
use fuels::prelude::*;
use fuels_contract::script::Script;
pub async fn run_compiled_script(binary_filepath: &str) -> Result<Vec<Receipt>, Error> {
... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/methods/mod.rs | test/src/sdk-harness/test_projects/methods/mod.rs | use fuels::prelude::*;
abigen!(Contract(
name = "MethodsContract",
abi = "test_artifacts/methods_contract/out/release/methods_contract-abi.json",
));
#[tokio::test]
async fn run_methods_test() {
let wallet = launch_provider_and_get_wallet().await.unwrap();
let instance = get_methods_instance(wallet).a... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/option_in_abi/mod.rs | test/src/sdk-harness/test_projects/option_in_abi/mod.rs | use fuels::{prelude::*, types::Bits256};
use std::str::FromStr;
abigen!(Contract(
name = "OptionInAbiTestContract",
abi = "test_projects/option_in_abi/out/release/option_in_abi-abi.json"
));
async fn get_option_in_abi_instance() -> (OptionInAbiTestContract<Wallet>, ContractId) {
let wallet = launch_provid... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/call_frames/mod.rs | test/src/sdk-harness/test_projects/call_frames/mod.rs | use fuels::{prelude::*, types::ContractId};
abigen!(Contract(
name = "CallFramesTestContract",
abi = "test_projects/call_frames/out/release/call_frames-abi.json"
));
async fn get_call_frames_instance() -> (CallFramesTestContract<Wallet>, ContractId) {
let wallet = launch_provider_and_get_wallet().await.un... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/block/mod.rs | test/src/sdk-harness/test_projects/block/mod.rs | use fuels::{prelude::*, types::Bits256};
use tai64::Tai64;
use tokio::time::{sleep, Duration};
abigen!(Contract(
name = "BlockTestContract",
abi = "test_projects/block/out/release/block-abi.json"
));
async fn get_block_instance() -> (BlockTestContract<Wallet>, ContractId, Provider) {
let wallet = launch_p... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/messages/mod.rs | test/src/sdk-harness/test_projects/messages/mod.rs | use fuels::{prelude::*, types::Bits256};
abigen!(Contract(
name = "TestMessagesContract",
abi = "test_projects/messages/out/release/messages-abi.json"
));
async fn get_messages_contract_instance() -> (TestMessagesContract<Wallet>, ContractId, Wallet) {
let num_wallets = 1;
let coins_per_wallet = 1;
... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/time/mod.rs | test/src/sdk-harness/test_projects/time/mod.rs | use fuels::prelude::*;
use tokio::time::{sleep, Duration};
use std::time::{SystemTime, UNIX_EPOCH};
abigen!(Contract(
name = "TimeTestContract",
abi = "test_projects/time/out/release/time-abi.json"
));
async fn get_block_instance() -> (TimeTestContract<Wallet>, ContractId, Provider) {
let wallet = launch_... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/configurables_in_contract/mod.rs | test/src/sdk-harness/test_projects/configurables_in_contract/mod.rs | use fuels::{prelude::*, types::SizedAsciiString};
// TODO Remove ignore when SDK supports encoding V1 for configurables
// https://github.com/FuelLabs/sway/issues/5727
#[tokio::test]
#[ignore]
async fn contract_uses_default_configurables() -> Result<()> {
abigen!(Contract(
name = "MyContract",
abi ... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/configurables_in_script/mod.rs | test/src/sdk-harness/test_projects/configurables_in_script/mod.rs | use fuels::{prelude::*, types::SizedAsciiString};
// TODO Remove ignore when SDK supports encoding V1 for configurables
// https://github.com/FuelLabs/sway/issues/5727
#[tokio::test]
#[ignore]
async fn script_uses_default_configurables() -> Result<()> {
abigen!(Script(
name = "MyScript",
abi = "tes... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/script_data/mod.rs | test/src/sdk-harness/test_projects/script_data/mod.rs | use assert_matches::assert_matches;
use fuels::{prelude::*, tx::Receipt, types::transaction_builders::ScriptTransactionBuilder};
async fn call_script(script_data: Vec<u8>) -> Result<Vec<Receipt>> {
let wallet = launch_provider_and_get_wallet().await.unwrap();
let provider = wallet.provider();
let wallet_c... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/exponentiation/mod.rs | test/src/sdk-harness/test_projects/exponentiation/mod.rs | use fuels::prelude::*;
use fuels::types::ContractId;
abigen!(Contract(
name = "TestPowContract",
abi = "test_artifacts/pow/out/release/pow-abi.json"
));
#[tokio::test]
#[should_panic(expected = "ArithmeticOverflow")]
async fn overflowing_pow_u64_panics() {
let wallet = launch_provider_and_get_wallet().awa... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
FuelLabs/sway | https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec_to_vec/mod.rs | test/src/sdk-harness/test_projects/storage_vec_to_vec/mod.rs | use fuels::prelude::*;
abigen!(Contract(
name = "TestStorageVecToVecContract",
abi = "test_projects/storage_vec_to_vec/out/release/storage_vec_to_vec-abi.json",
));
async fn test_storage_vec_to_vec_instance() -> TestStorageVecToVecContract<Wallet> {
let wallet = launch_provider_and_get_wallet().await.unwr... | rust | Apache-2.0 | cc8f867043f3ec2c14ec4088d449cde603929a80 | 2026-01-04T15:31:58.694488Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.