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
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/api/requests/workspace_symbols.rs
crates/ty_server/src/server/api/requests/workspace_symbols.rs
use lsp_types::request::WorkspaceSymbolRequest; use lsp_types::{WorkspaceSymbolParams, WorkspaceSymbolResponse}; use ty_ide::{WorkspaceSymbolInfo, workspace_symbols}; use crate::server::api::symbols::convert_to_lsp_symbol_information; use crate::server::api::traits::{ BackgroundRequestHandler, RequestHandler, Retr...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/api/requests/code_action.rs
crates/ty_server/src/server/api/requests/code_action.rs
use std::borrow::Cow; use std::collections::HashMap; use lsp_types::{self as types, NumberOrString, TextEdit, Url, request as req}; use ruff_db::files::File; use ruff_diagnostics::Edit; use ruff_text_size::Ranged; use ty_ide::code_actions; use ty_project::ProjectDatabase; use types::{CodeActionKind, CodeActionOrComman...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/api/requests/diagnostic.rs
crates/ty_server/src/server/api/requests/diagnostic.rs
use std::borrow::Cow; use lsp_types::request::DocumentDiagnosticRequest; use lsp_types::{ DocumentDiagnosticParams, DocumentDiagnosticReport, DocumentDiagnosticReportResult, FullDocumentDiagnosticReport, RelatedFullDocumentDiagnosticReport, RelatedUnchangedDocumentDiagnosticReport, UnchangedDocumentDiagnos...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/api/notifications/did_open_notebook.rs
crates/ty_server/src/server/api/notifications/did_open_notebook.rs
use lsp_server::ErrorCode; use lsp_types::DidOpenNotebookDocumentParams; use lsp_types::notification::DidOpenNotebookDocument; use crate::TextDocument; use crate::document::NotebookDocument; use crate::server::Result; use crate::server::api::LSPResult; use crate::server::api::diagnostics::publish_diagnostics; use crat...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/api/notifications/did_close_notebook.rs
crates/ty_server/src/server/api/notifications/did_close_notebook.rs
use lsp_types::notification::DidCloseNotebookDocument; use lsp_types::{DidCloseNotebookDocumentParams, NotebookDocumentIdentifier}; use crate::server::Result; use crate::server::api::LSPResult; use crate::server::api::traits::{NotificationHandler, SyncNotificationHandler}; use crate::session::Session; use crate::sessi...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/api/notifications/cancel.rs
crates/ty_server/src/server/api/notifications/cancel.rs
use lsp_server::RequestId; use lsp_types::CancelParams; use lsp_types::notification::Cancel; use crate::server::Result; use crate::server::api::traits::{NotificationHandler, SyncNotificationHandler}; use crate::session::Session; use crate::session::client::Client; pub(crate) struct CancelNotificationHandler; impl No...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/api/notifications/did_open.rs
crates/ty_server/src/server/api/notifications/did_open.rs
use lsp_types::notification::DidOpenTextDocument; use lsp_types::{DidOpenTextDocumentParams, TextDocumentItem}; use crate::TextDocument; use crate::server::Result; use crate::server::api::diagnostics::publish_diagnostics_if_needed; use crate::server::api::traits::{NotificationHandler, SyncNotificationHandler}; use cra...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/api/notifications/did_change_notebook.rs
crates/ty_server/src/server/api/notifications/did_change_notebook.rs
use lsp_server::ErrorCode; use lsp_types as types; use lsp_types::notification as notif; use crate::server::Result; use crate::server::api::LSPResult; use crate::server::api::diagnostics::publish_diagnostics; use crate::server::api::traits::{NotificationHandler, SyncNotificationHandler}; use crate::session::Session; u...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/api/notifications/did_change.rs
crates/ty_server/src/server/api/notifications/did_change.rs
use lsp_server::ErrorCode; use lsp_types::notification::DidChangeTextDocument; use lsp_types::{DidChangeTextDocumentParams, VersionedTextDocumentIdentifier}; use crate::server::Result; use crate::server::api::LSPResult; use crate::server::api::diagnostics::publish_diagnostics_if_needed; use crate::server::api::traits:...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/api/notifications/did_change_watched_files.rs
crates/ty_server/src/server/api/notifications/did_change_watched_files.rs
use crate::document::DocumentKey; use crate::server::Result; use crate::server::api::diagnostics::{ publish_diagnostics_if_needed, publish_settings_diagnostics, }; use crate::server::api::traits::{NotificationHandler, SyncNotificationHandler}; use crate::session::Session; use crate::session::client::Client; use cra...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/api/notifications/did_close.rs
crates/ty_server/src/server/api/notifications/did_close.rs
use lsp_server::ErrorCode; use lsp_types::notification::DidCloseTextDocument; use lsp_types::{DidCloseTextDocumentParams, TextDocumentIdentifier}; use crate::server::Result; use crate::server::api::LSPResult; use crate::server::api::diagnostics::clear_diagnostics_if_needed; use crate::server::api::traits::{Notificatio...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/schedule/task.rs
crates/ty_server/src/server/schedule/task.rs
use lsp_server::RequestId; use serde::Serialize; use crate::session::Session; use crate::session::client::Client; type LocalFn = Box<dyn FnOnce(&mut Session, &Client)>; type BackgroundFn = Box<dyn FnOnce(&Client) + Send + 'static>; type BackgroundFnBuilder = Box<dyn FnOnce(&Session) -> BackgroundFn>; /// Describes...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/schedule/thread.rs
crates/ty_server/src/server/schedule/thread.rs
// +------------------------------------------------------------+ // | Code adopted from: | // | Repository: https://github.com/rust-lang/rust-analyzer.git | // | File: `crates/stdx/src/thread.rs` | // | Commit: 03b3cb6be9f21c082f4206b35c7fe7f291c94eaa ...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/schedule/thread/priority.rs
crates/ty_server/src/server/schedule/thread/priority.rs
// +------------------------------------------------------------+ // | Code adopted from: | // | Repository: https://github.com/rust-lang/rust-analyzer.git | // | File: `crates/stdx/src/thread/intent.rs` | // | Commit: 03b3cb6be9f21c082f4206b35c7fe7f291c94eaa ...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/server/schedule/thread/pool.rs
crates/ty_server/src/server/schedule/thread/pool.rs
// +------------------------------------------------------------+ // | Code adopted from: | // | Repository: https://github.com/rust-lang/rust-analyzer.git | // | File: `crates/stdx/src/thread/pool.rs` | // | Commit: 03b3cb6be9f21c082f4206b35c7fe7f291c94eaa ...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/document/notebook.rs
crates/ty_server/src/document/notebook.rs
use lsp_types::NotebookCellKind; use ruff_notebook::CellMetadata; use ruff_source_file::OneIndexed; use rustc_hash::FxHashMap; use super::{DocumentKey, DocumentVersion}; use crate::session::index::Index; /// A notebook document. /// /// This notebook document only stores the metadata about the notebook /// and the ce...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/document/range.rs
crates/ty_server/src/document/range.rs
use super::PositionEncoding; use crate::Db; use crate::system::file_to_url; use ruff_db::files::{File, FileRange}; use ruff_db::source::{line_index, source_text}; use ruff_source_file::LineIndex; use ruff_source_file::{OneIndexed, SourceLocation}; use ruff_text_size::{Ranged, TextRange, TextSize}; /// A range in an L...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/document/text_document.rs
crates/ty_server/src/document/text_document.rs
use lsp_types::{TextDocumentContentChangeEvent, Url}; use ruff_source_file::LineIndex; use crate::PositionEncoding; use crate::document::range::lsp_range_to_text_range; use crate::system::AnySystemPath; pub(crate) type DocumentVersion = i32; /// A regular text file or the content of a notebook cell. /// /// The stat...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/src/document/location.rs
crates/ty_server/src/document/location.rs
use lsp_types::Location; use ruff_db::files::FileRange; use ty_ide::{NavigationTarget, ReferenceTarget}; use crate::Db; use crate::PositionEncoding; use crate::document::{FileRangeExt, ToRangeExt}; pub(crate) trait ToLink { fn to_location(&self, db: &dyn Db, encoding: PositionEncoding) -> Option<Location>; f...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/notebook.rs
crates/ty_server/tests/e2e/notebook.rs
use insta::assert_json_snapshot; use lsp_types::{NotebookCellKind, Position, Range}; use ruff_db::system::SystemPath; use ty_server::ClientOptions; use crate::{TestServer, TestServerBuilder}; static FILTERS: &[(&str, &str)] = &[(r#""sortText": "[0-9 ]+""#, r#""sortText": "[RANKING]""#)]; #[test] fn publish_diagnosti...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/code_actions.rs
crates/ty_server/tests/e2e/code_actions.rs
use crate::{TestServer, TestServerBuilder}; use anyhow::Result; use lsp_types::{DocumentDiagnosticReportResult, Position, Range, request::CodeActionRequest}; use ruff_db::system::SystemPath; fn code_actions_at( server: &TestServer, diagnostics: DocumentDiagnosticReportResult, file: &SystemPath, range: ...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/pull_diagnostics.rs
crates/ty_server/tests/e2e/pull_diagnostics.rs
use std::time::Duration; use anyhow::Result; use insta::{assert_compact_json_snapshot, assert_debug_snapshot}; use lsp_server::RequestId; use lsp_types::request::WorkspaceDiagnosticRequest; use lsp_types::{ NumberOrString, PartialResultParams, PreviousResultId, Url, WorkDoneProgressParams, WorkspaceDiagnosticP...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/configuration.rs
crates/ty_server/tests/e2e/configuration.rs
use anyhow::Result; use insta::assert_json_snapshot; use ruff_db::system::SystemPath; use serde_json::{Map, json}; use ty_server::{ClientOptions, WorkspaceOptions}; use crate::TestServerBuilder; use crate::pull_diagnostics::filter_result_id; #[test] fn configuration_file() -> Result<()> { let _filter = filter_res...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/rename.rs
crates/ty_server/tests/e2e/rename.rs
use crate::TestServerBuilder; use crate::notebook::NotebookBuilder; use insta::assert_json_snapshot; #[test] fn text_document() -> anyhow::Result<()> { let mut server = TestServerBuilder::new()? .with_file("foo.py", "")? .enable_pull_diagnostics(true) .build() .wait_until_workspaces...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/semantic_tokens.rs
crates/ty_server/tests/e2e/semantic_tokens.rs
use anyhow::Result; use ruff_db::system::SystemPath; use crate::TestServerBuilder; #[test] fn multiline_token_client_not_supporting_multiline_tokens() -> Result<()> { let workspace_root = SystemPath::new("src"); let foo = SystemPath::new("src/foo.py"); let foo_content = r#"def my_function(param1: int, par...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/inlay_hints.rs
crates/ty_server/tests/e2e/inlay_hints.rs
use anyhow::Result; use lsp_types::{Position, Range, notification::PublishDiagnostics}; use ruff_db::system::SystemPath; use ty_server::ClientOptions; use crate::TestServerBuilder; /// Tests that the default value of inlay hints settings is correct i.e., they're all enabled /// by default. #[test] fn default_inlay_hi...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/initialize.rs
crates/ty_server/tests/e2e/initialize.rs
use anyhow::Result; use lsp_types::notification::ShowMessage; use lsp_types::{Position, request::RegisterCapability}; use ruff_db::system::SystemPath; use serde_json::Value; use ty_server::{ClientOptions, DiagnosticMode}; use crate::TestServerBuilder; #[test] fn empty_workspace_folders() -> Result<()> { let serve...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/commands.rs
crates/ty_server/tests/e2e/commands.rs
use anyhow::Result; use lsp_types::{ExecuteCommandParams, WorkDoneProgressParams, request::ExecuteCommand}; use ruff_db::system::SystemPath; use crate::{TestServer, TestServerBuilder}; // Sends an executeCommand request to the TestServer fn execute_command( server: &mut TestServer, command: String, argume...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/completions.rs
crates/ty_server/tests/e2e/completions.rs
use anyhow::Result; use lsp_types::{Position, notification::PublishDiagnostics}; use ruff_db::system::SystemPath; use ty_server::ClientOptions; use crate::TestServerBuilder; /// Tests that auto-import is enabled by default. #[test] fn default_auto_import() -> Result<()> { let workspace_root = SystemPath::new("src...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/publish_diagnostics.rs
crates/ty_server/tests/e2e/publish_diagnostics.rs
use std::time::Duration; use anyhow::Result; use lsp_types::{ DidOpenTextDocumentParams, FileChangeType, FileEvent, TextDocumentItem, notification::{DidOpenTextDocument, PublishDiagnostics}, }; use ruff_db::system::SystemPath; use ty_server::ClientOptions; use crate::TestServerBuilder; #[test] fn on_did_open...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/main.rs
crates/ty_server/tests/e2e/main.rs
//! Testing server for the ty language server. //! //! This module provides mock server infrastructure for testing LSP functionality using a //! temporary directory on the real filesystem. //! //! The design is inspired by the Starlark LSP test server but adapted for ty server architecture. //! //! To get started, use ...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_server/tests/e2e/signature_help.rs
crates/ty_server/tests/e2e/signature_help.rs
use anyhow::Result; use lsp_types::{Position, notification::PublishDiagnostics}; use ruff_db::system::SystemPath; use ty_server::ClientOptions; use crate::TestServerBuilder; /// Tests that we get signature help even when the cursor /// is on the function name. /// /// This is a regression test to ensure we don't acci...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_workspace/src/settings.rs
crates/ruff_workspace/src/settings.rs
use path_absolutize::path_dedot; use ruff_cache::cache_dir; use ruff_formatter::{FormatOptions, IndentStyle, IndentWidth, LineWidth}; use ruff_graph::AnalyzeSettings; use ruff_linter::display_settings; use ruff_linter::settings::LinterSettings; use ruff_linter::settings::types::{ CompiledPerFileTargetVersionList, E...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_workspace/src/pyproject.rs
crates/ruff_workspace/src/pyproject.rs
//! Utilities for locating (and extracting configuration from) a pyproject.toml. use std::path::{Path, PathBuf}; use anyhow::{Context, Result}; use log::debug; use pep440_rs::{Operator, Version, VersionSpecifiers}; use serde::{Deserialize, Serialize}; use strum::IntoEnumIterator; use ruff_linter::settings::types::Py...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_workspace/src/lib.rs
crates/ruff_workspace/src/lib.rs
pub mod configuration; pub mod options; pub mod pyproject; pub mod resolver; mod settings; pub use settings::{FileResolverSettings, FormatterSettings, Settings}; #[cfg(test)] mod tests { use std::path::Path; pub(crate) fn test_resource_path(path: impl AsRef<Path>) -> std::path::PathBuf { Path::new("...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_workspace/src/configuration.rs
crates/ruff_workspace/src/configuration.rs
//! User-provided program settings, taking into account pyproject.toml and //! command-line options. Structure mirrors the user-facing representation of //! the various parameters. use std::borrow::Cow; use std::collections::BTreeMap; use std::env::VarError; use std::num::{NonZeroU8, NonZeroU16}; use std::path::{Path,...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_workspace/src/options.rs
crates/ruff_workspace/src/options.rs
use regex::Regex; use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet}; use serde::de::{self}; use serde::{Deserialize, Deserializer, Serialize}; use std::collections::{BTreeMap, BTreeSet}; use std::path::PathBuf; use strum::IntoEnumIterator; use unicode_normalization::UnicodeNormalization; use crate::settings::LineE...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_workspace/src/resolver.rs
crates/ruff_workspace/src/resolver.rs
//! Discover Python files, and their corresponding [`Settings`], from the //! filesystem. use std::cmp::Ordering; use std::collections::BTreeSet; use std::ffi::OsStr; use std::path::{Path, PathBuf}; use std::sync::RwLock; use anyhow::{Context, Result}; use anyhow::{anyhow, bail}; use globset::{Candidate, GlobSet}; us...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/shared_traits.rs
crates/ruff_formatter/shared_traits.rs
/// Used to get an object that knows how to format this object. pub trait AsFormat<Context> { type Format<'a>: ruff_formatter::Format<Context> where Self: 'a; /// Returns an object that is able to format this object. fn format(&self) -> Self::Format<'_>; } /// Implement [`AsFormat`] for refere...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/diagnostics.rs
crates/ruff_formatter/src/diagnostics.rs
use crate::GroupId; use crate::prelude::TagKind; use ruff_text_size::TextRange; use std::error::Error; #[derive(Debug, PartialEq, Eq, Copy, Clone)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] /// Series of errors encountered during formatting pub enum FormatError { /// In case a no...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/prelude.rs
crates/ruff_formatter/src/prelude.rs
pub use crate::builders::*; pub use crate::format_element::document::Document; pub use crate::format_element::tag::{LabelId, Tag, TagKind}; pub use crate::format_element::*; pub use crate::format_extensions::{MemoizeFormat, Memoized}; pub use crate::formatter::Formatter; pub use crate::printer::PrinterOptions; pub use...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/lib.rs
crates/ruff_formatter/src/lib.rs
//! Infrastructure for code formatting //! //! This module defines [`FormatElement`], an IR to format code documents and provides a means to print //! such a document to a string. Objects that know how to format themselves implement the [Format] trait. //! //! ## Formatting Traits //! //! * [`Format`]: Implemented by o...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/source_code.rs
crates/ruff_formatter/src/source_code.rs
use std::fmt::{Debug, Formatter}; use ruff_text_size::{Ranged, TextRange}; /// The source code of a document that gets formatted #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Default)] pub struct SourceCode<'a> { text: &'a str, } impl<'a> SourceCode<'a> { pub fn new(text: &'a str) -> Self { S...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/format_extensions.rs
crates/ruff_formatter/src/format_extensions.rs
use crate::prelude::*; use std::cell::OnceCell; use std::marker::PhantomData; use crate::Buffer; /// Utility trait that allows memorizing the output of a [`Format`]. /// Useful to avoid re-formatting the same object twice. pub trait MemoizeFormat<Context> { /// Returns a formattable object that memoizes the resul...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/arguments.rs
crates/ruff_formatter/src/arguments.rs
use super::{Buffer, Format, Formatter}; use crate::FormatResult; /// A convenience wrapper for representing a formattable argument. pub struct Argument<'fmt, Context> { value: &'fmt dyn Format<Context>, } impl<Context> Clone for Argument<'_, Context> { fn clone(&self) -> Self { *self } } impl<Cont...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/builders.rs
crates/ruff_formatter/src/builders.rs
use std::cell::Cell; use std::marker::PhantomData; use std::num::NonZeroU8; #[allow(clippy::enum_glob_use)] use Tag::*; use ruff_text_size::TextRange; use crate::format_element::tag::{Condition, Tag}; use crate::prelude::tag::{DedentMode, GroupMode, LabelId}; use crate::prelude::*; use crate::{Argument, Arguments, Fo...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/macros.rs
crates/ruff_formatter/src/macros.rs
/// Constructs the parameters for other formatting macros. /// /// This macro functions by taking a list of objects implementing [`crate::Format`]. It will canonicalize the /// arguments into a single type. /// /// This macro produces a value of type [`crate::Arguments`]. This value can be passed to /// the macros with...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/group_id.rs
crates/ruff_formatter/src/group_id.rs
use std::num::NonZeroU32; use std::sync::atomic::{AtomicU32, Ordering}; #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Eq, PartialEq, Hash)] pub struct DebugGroupId { value: NonZeroU32, #[cfg_attr(feature = "serde", serde(skip))] name: &'static str, } im...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/buffer.rs
crates/ruff_formatter/src/buffer.rs
use super::{Arguments, FormatElement, write}; use crate::format_element::Interned; use crate::prelude::{LineMode, Tag}; use crate::{FormatResult, FormatState}; use rustc_hash::FxHashMap; use std::any::{Any, TypeId}; use std::fmt::Debug; use std::num::NonZeroUsize; use std::ops::{Deref, DerefMut}; /// A trait for writi...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/formatter.rs
crates/ruff_formatter/src/formatter.rs
use crate::buffer::BufferSnapshot; use crate::builders::{FillBuilder, JoinBuilder}; use crate::prelude::*; use crate::{Arguments, Buffer, FormatContext, FormatState, GroupId, VecBuffer}; /// Handles the formatting of a CST and stores the context how the CST should be formatted (user preferences). /// The formatter is ...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/format_element.rs
crates/ruff_formatter/src/format_element.rs
pub mod document; pub mod tag; use std::borrow::Cow; use std::hash::{Hash, Hasher}; use std::iter::FusedIterator; use std::num::NonZeroU32; use std::ops::Deref; use std::rc::Rc; use unicode_width::UnicodeWidthChar; use crate::format_element::tag::{GroupMode, LabelId, Tag}; use crate::source_code::SourceCodeSlice; use...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/format_element/document.rs
crates/ruff_formatter/src/format_element/document.rs
use std::collections::HashMap; use std::ops::Deref; use rustc_hash::FxHashMap; use crate::format_element::tag::{Condition, DedentMode}; use crate::prelude::tag::GroupMode; use crate::prelude::*; use crate::source_code::SourceCode; use crate::{ BufferExtensions, Format, FormatContext, FormatElement, FormatOptions,...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/format_element/tag.rs
crates/ruff_formatter/src/format_element/tag.rs
use crate::format_element::PrintMode; use crate::{GroupId, TextSize}; use std::cell::Cell; use std::num::NonZeroU8; /// A Tag marking the start and end of some content to which some special formatting should be applied. /// /// Tags always come in pairs of a start and an end tag and the styling defined by this tag ///...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/printer/line_suffixes.rs
crates/ruff_formatter/src/printer/line_suffixes.rs
use crate::FormatElement; use crate::printer::call_stack::PrintElementArgs; /// Stores the queued line suffixes. #[derive(Debug, Default)] pub(super) struct LineSuffixes<'a> { suffixes: Vec<LineSuffixEntry<'a>>, } impl<'a> LineSuffixes<'a> { /// Extends the line suffixes with `elements`, storing their call st...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/printer/call_stack.rs
crates/ruff_formatter/src/printer/call_stack.rs
use crate::format_element::PrintMode; use crate::format_element::tag::TagKind; use crate::printer::stack::{Stack, StackedStack}; use crate::printer::{Indentation, MeasureMode}; use crate::{IndentStyle, InvalidDocumentError, PrintError, PrintResult}; use std::fmt::Debug; use std::num::NonZeroU8; #[derive(Copy, Clone, E...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/printer/mod.rs
crates/ruff_formatter/src/printer/mod.rs
use std::num::NonZeroU8; use drop_bomb::DebugDropBomb; use unicode_width::UnicodeWidthChar; pub use printer_options::*; use ruff_text_size::{TextLen, TextSize}; use crate::format_element::document::Document; use crate::format_element::tag::{Condition, GroupMode}; use crate::format_element::{BestFittingMode, BestFitt...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/printer/stack.rs
crates/ruff_formatter/src/printer/stack.rs
/// A school book stack. Allows adding, removing, and inspecting elements at the back. pub(super) trait Stack<T> { /// Removes the last element if any and returns it fn pop(&mut self) -> Option<T>; /// Pushes a new element at the back fn push(&mut self, value: T); /// Returns the last element if a...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/printer/queue.rs
crates/ruff_formatter/src/printer/queue.rs
use crate::format_element::tag::TagKind; use crate::prelude::Tag; use crate::printer::{invalid_end_tag, invalid_start_tag}; use crate::{FormatElement, PrintResult}; use std::fmt::Debug; use std::iter::FusedIterator; use std::marker::PhantomData; /// Queue of [`FormatElement`]s. pub(super) trait Queue<'a> { /// Pop...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_formatter/src/printer/printer_options/mod.rs
crates/ruff_formatter/src/printer/printer_options/mod.rs
use crate::{FormatOptions, IndentStyle, IndentWidth, LineWidth}; /// Options that affect how the [`crate::Printer`] prints the format tokens #[derive(Clone, Debug, Eq, PartialEq, Default)] pub struct PrinterOptions { /// Width of a single tab character (does it equal 2, 4, ... spaces?) pub indent_width: Indent...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_memory_usage/src/lib.rs
crates/ruff_memory_usage/src/lib.rs
use std::cell::RefCell; use get_size2::{GetSize, StandardTracker}; use ordermap::{OrderMap, OrderSet}; thread_local! { pub static TRACKER: RefCell<Option<StandardTracker>>= const { RefCell::new(None) }; } struct TrackerGuard(Option<StandardTracker>); impl Drop for TrackerGuard { fn drop(&mut self) { ...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_python_ast_integration_tests/src/lib.rs
crates/ruff_python_ast_integration_tests/src/lib.rs
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_python_ast_integration_tests/tests/visitor.rs
crates/ruff_python_ast_integration_tests/tests/visitor.rs
use std::fmt::{Debug, Write}; use insta::assert_snapshot; use ruff_python_ast::visitor::{ Visitor, walk_alias, walk_bytes_literal, walk_comprehension, walk_except_handler, walk_expr, walk_f_string, walk_interpolated_string_element, walk_keyword, walk_match_case, walk_parameter, walk_parameters, walk_patte...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_python_ast_integration_tests/tests/stmt_if.rs
crates/ruff_python_ast_integration_tests/tests/stmt_if.rs
use ruff_python_ast::stmt_if::elif_else_range; use ruff_python_parser::{ParseError, parse_module}; use ruff_text_size::TextSize; #[test] fn extract_elif_else_range() -> Result<(), ParseError> { let contents = "if a: ... elif b: ... "; let parsed = parse_module(contents)?; let if_stmt = parsed ...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_python_ast_integration_tests/tests/match_pattern.rs
crates/ruff_python_ast_integration_tests/tests/match_pattern.rs
use ruff_python_parser::parse_module; #[test] fn pattern_is_wildcard() { let source_code = r" match subject: case _ as x: ... case _ | _: ... case _: ... "; let parsed = parse_module(source_code).unwrap(); let cases = &parsed.syntax().body[0].as_match_stmt().unwrap().cases; for case in case...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_python_ast_integration_tests/tests/comparable.rs
crates/ruff_python_ast_integration_tests/tests/comparable.rs
use ruff_python_ast::comparable::ComparableExpr; use ruff_python_parser::{ParseError, parse_expression}; #[track_caller] fn assert_comparable(left: &str, right: &str) -> Result<(), ParseError> { let left_parsed = parse_expression(left)?; let right_parsed = parse_expression(right)?; let left_compr = Compar...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_python_ast_integration_tests/tests/parentheses.rs
crates/ruff_python_ast_integration_tests/tests/parentheses.rs
//! Tests for [`ruff_python_ast::tokens::parentheses_iterator`] and //! [`ruff_python_ast::tokens::parenthesized_range`]. use ruff_python_ast::{ self as ast, Expr, token::{parentheses_iterator, parenthesized_range}, }; use ruff_python_parser::parse_module; #[test] fn test_no_parentheses() { let source = "...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_python_ast_integration_tests/tests/identifier.rs
crates/ruff_python_ast_integration_tests/tests/identifier.rs
use ruff_python_ast::identifier; use ruff_python_parser::{ParseError, parse_module}; use ruff_text_size::{TextRange, TextSize}; #[test] fn extract_else_range() -> Result<(), ParseError> { let contents = r" for x in y: pass else: pass " .trim(); let stmts = parse_module(contents)?.into_suite(); ...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_python_ast_integration_tests/tests/source_order.rs
crates/ruff_python_ast_integration_tests/tests/source_order.rs
use std::fmt::{Debug, Write}; use insta::assert_snapshot; use ruff_python_ast::visitor::source_order::{SourceOrderVisitor, TraversalSignal}; use ruff_python_ast::{AnyNodeRef, BoolOp, CmpOp, Operator, Singleton, UnaryOp}; use ruff_python_parser::{Mode, ParseOptions, parse}; #[test] fn function_arguments() { let s...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ruff_python_ast_integration_tests/tests/parenthesize.rs
crates/ruff_python_ast_integration_tests/tests/parenthesize.rs
use ruff_python_ast::parenthesize::parenthesized_range; use ruff_python_parser::parse_expression; use ruff_python_trivia::CommentRanges; use ruff_text_size::TextRange; #[test] fn test_parenthesized_name() { let source_code = r"(x) + 1"; let parsed = parse_expression(source_code).unwrap(); let bin_op = par...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/build.rs
crates/ty/build.rs
use std::{ fs, path::{Path, PathBuf}, process::Command, }; fn main() { // The workspace root directory is not available without walking up the tree // https://github.com/rust-lang/cargo/issues/3946 let ruff_workspace_root = Path::new(&std::env::var("CARGO_MANIFEST_DIR").unwrap()) .join(...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/src/lib.rs
crates/ty/src/lib.rs
mod args; mod logging; mod printer; mod python_version; mod version; pub use args::Cli; use ty_project::metadata::settings::TerminalSettings; use ty_static::EnvVars; use std::fmt::Write; use std::process::{ExitCode, Termination}; use std::sync::Mutex; use anyhow::Result; use crate::args::{CheckCommand, Command, Ter...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/src/python_version.rs
crates/ty/src/python_version.rs
/// Enumeration of all supported Python versions /// /// TODO: unify with the `PythonVersion` enum in the linter/formatter crates? #[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, PartialOrd, Ord, Default, clap::ValueEnum)] pub enum PythonVersion { #[value(name = "3.7")] Py37, #[value(name = "3.8")] Py...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/src/version.rs
crates/ty/src/version.rs
//! Code for representing ty's release version number. use std::fmt; /// Information about the git repository where ty was built from. pub(crate) struct CommitInfo { short_commit_hash: String, commit_date: String, commits_since_last_tag: u32, last_tag: Option<String>, } /// ty's version. pub(crate) st...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/src/args.rs
crates/ty/src/args.rs
use crate::logging::Verbosity; use crate::python_version::PythonVersion; use clap::builder::Styles; use clap::builder::styling::{AnsiColor, Effects}; use clap::error::ErrorKind; use clap::{ArgAction, ArgMatches, Error, Parser}; use ruff_db::system::SystemPathBuf; use ty_combine::Combine; use ty_project::metadata::optio...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/src/printer.rs
crates/ty/src/printer.rs
use std::io::StdoutLock; use anyhow::Result; use indicatif::ProgressDrawTarget; use crate::logging::VerbosityLevel; #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub(crate) struct Printer { verbosity: VerbosityLevel, no_progress: bool, } impl Printer { pub(crate) fn new(verbosity: VerbosityLevel...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/src/main.rs
crates/ty/src/main.rs
use colored::Colorize; use std::io; use ty::{ExitStatus, run}; #[cfg(all( not(target_os = "macos"), not(target_os = "windows"), not(target_os = "openbsd"), not(target_os = "aix"), not(target_os = "android"), any( target_arch = "x86_64", target_arch = "aarch64", target_ar...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/src/logging.rs
crates/ty/src/logging.rs
//! Sets up logging for ty use crate::args::TerminalColor; use anyhow::Context; use colored::Colorize; use std::fmt; use std::fs::File; use std::io::{BufWriter, IsTerminal}; use tracing::{Event, Subscriber}; use tracing_subscriber::EnvFilter; use tracing_subscriber::filter::LevelFilter; use tracing_subscriber::fmt::fo...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/tests/file_watching.rs
crates/ty/tests/file_watching.rs
use std::collections::HashSet; use std::io::Write; use std::time::{Duration, Instant}; use anyhow::{Context, anyhow}; use ruff_db::Db as _; use ruff_db::files::{File, FileError, system_path_to_file}; use ruff_db::source::source_text; use ruff_db::system::{ OsSystem, System, SystemPath, SystemPathBuf, UserConfigDir...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/tests/cli/rule_selection.rs
crates/ty/tests/cli/rule_selection.rs
use insta_cmd::assert_cmd_snapshot; use crate::CliTest; /// The rule severity can be changed in the configuration file #[test] fn configuration_rule_severity() -> anyhow::Result<()> { let case = CliTest::with_file( "test.py", r#" y = 4 / 0 for a in range(0, int(y)): ...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/tests/cli/analysis_options.rs
crates/ty/tests/cli/analysis_options.rs
use insta_cmd::assert_cmd_snapshot; use crate::CliTest; /// ty ignores `type: ignore` comments when setting `respect-type-ignore-comments=false` #[test] fn respect_type_ignore_comments_is_turned_off() -> anyhow::Result<()> { let case = CliTest::with_file( "test.py", r#" y = a + 5 # ty...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/tests/cli/config_option.rs
crates/ty/tests/cli/config_option.rs
use insta_cmd::assert_cmd_snapshot; use crate::CliTest; #[test] fn cli_config_args_toml_string_basic() -> anyhow::Result<()> { let case = CliTest::with_file("test.py", r"print(x) # [unresolved-reference]")?; // Long flag assert_cmd_snapshot!(case.command().arg("--warn").arg("unresolved-reference").arg("...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/tests/cli/exit_code.rs
crates/ty/tests/cli/exit_code.rs
use insta_cmd::assert_cmd_snapshot; use crate::CliTest; #[test] fn only_warnings() -> anyhow::Result<()> { let case = CliTest::with_file("test.py", r"print(x) # [unresolved-reference]")?; assert_cmd_snapshot!(case.command().arg("--warn").arg("unresolved-reference"), @r###" success: true exit_code: 0...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/tests/cli/main.rs
crates/ty/tests/cli/main.rs
mod analysis_options; mod config_option; mod exit_code; mod file_selection; mod python_environment; mod rule_selection; use anyhow::Context as _; use insta::Settings; use insta::internals::SettingsBindDropGuard; use insta_cmd::{assert_cmd_snapshot, get_cargo_bin}; use std::{ fmt::Write, path::{Path, PathBuf}, ...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/tests/cli/python_environment.rs
crates/ty/tests/cli/python_environment.rs
use insta_cmd::assert_cmd_snapshot; use ruff_python_ast::PythonVersion; use crate::{CliTest, site_packages_filter}; /// Specifying an option on the CLI should take precedence over the same setting in the /// project's configuration. Here, this is tested for the Python version. #[test] fn config_override_python_versio...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty/tests/cli/file_selection.rs
crates/ty/tests/cli/file_selection.rs
use insta_cmd::assert_cmd_snapshot; use crate::CliTest; /// Test exclude CLI argument functionality #[test] fn exclude_argument() -> anyhow::Result<()> { let case = CliTest::with_files([ ( "src/main.py", r#" print(undefined_var) # error: unresolved-reference ...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/doc_highlights.rs
crates/ty_ide/src/doc_highlights.rs
use crate::goto::find_goto_target; use crate::references::{ReferencesMode, references}; use crate::{Db, ReferenceTarget}; use ruff_db::files::File; use ruff_text_size::TextSize; use ty_python_semantic::SemanticModel; /// Find all document highlights for a symbol at the given position. /// Document highlights are limit...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/docstring.rs
crates/ty_ide/src/docstring.rs
//! Docstring parsing utilities for language server features. //! //! This module provides functionality for extracting structured information from //! Python docstrings, including parameter documentation for signature help. //! Supports Google-style, NumPy-style, and reST/Sphinx-style docstrings. //! There are no form...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/stub_mapping.rs
crates/ty_ide/src/stub_mapping.rs
use itertools::Either; use ruff_db::system::SystemPathBuf; use ty_python_semantic::{ResolvedDefinition, map_stub_definition}; use crate::cached_vendored_root; /// Maps `ResolvedDefinitions` from stub files to corresponding definitions in source files. /// /// This mapper is used to implement "Go To Definition" functi...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/all_symbols.rs
crates/ty_ide/src/all_symbols.rs
use ruff_db::files::File; use ty_module_resolver::{Module, ModuleName, all_modules, resolve_real_shadowable_module}; use ty_project::Db; use crate::{ SymbolKind, symbols::{QueryPattern, SymbolInfo, symbols_for_file_global_only}, }; /// Get all symbols matching the query string. /// /// Returns symbols from al...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/markup.rs
crates/ty_ide/src/markup.rs
use std::fmt; use std::fmt::Formatter; #[derive(Debug, Copy, Clone, Eq, PartialEq)] pub enum MarkupKind { PlainText, Markdown, } impl MarkupKind { pub(crate) const fn fenced_code_block<T>( self, code: T, language: &str, ) -> FencedCodeBlock<'_, T> where T: fmt::Disp...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/goto.rs
crates/ty_ide/src/goto.rs
use crate::docstring::Docstring; pub use crate::goto_declaration::goto_declaration; pub use crate::goto_definition::goto_definition; pub use crate::goto_type_definition::goto_type_definition; use std::borrow::Cow; use crate::stub_mapping::StubMapper; use ruff_db::parsed::ParsedModuleRef; use ruff_python_ast::find_nod...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/lib.rs
crates/ty_ide/src/lib.rs
#![warn( clippy::disallowed_methods, reason = "Prefer System trait methods over std methods in ty crates" )] mod all_symbols; mod code_action; mod completion; mod doc_highlights; mod docstring; mod document_symbols; mod find_references; mod goto; mod goto_declaration; mod goto_definition; mod goto_type_definiti...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/goto_declaration.rs
crates/ty_ide/src/goto_declaration.rs
use crate::goto::find_goto_target; use crate::{Db, NavigationTargets, RangedValue}; use ruff_db::files::{File, FileRange}; use ruff_db::parsed::parsed_module; use ruff_text_size::{Ranged, TextSize}; use ty_python_semantic::{ImportAliasResolution, SemanticModel}; /// Navigate to the declaration of a symbol. /// /// A "...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/completion.rs
crates/ty_ide/src/completion.rs
use std::cmp::Ordering; use ruff_db::files::File; use ruff_db::parsed::{ParsedModuleRef, parsed_module}; use ruff_db::source::{SourceText, source_text}; use ruff_diagnostics::Edit; use ruff_python_ast::find_node::{CoveringNode, covering_node}; use ruff_python_ast::name::Name; use ruff_python_ast::token::{Token, TokenK...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/rename.rs
crates/ty_ide/src/rename.rs
use crate::goto::find_goto_target; use crate::references::{ReferencesMode, references}; use crate::{Db, ReferenceTarget}; use ruff_db::files::File; use ruff_text_size::{Ranged, TextSize}; use ty_python_semantic::SemanticModel; /// Returns the range of the symbol if it can be renamed, None if not. pub fn can_rename(db:...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/importer.rs
crates/ty_ide/src/importer.rs
#![allow(warnings)] /*! An abstraction for adding new imports to a single Python source file. This importer is based on a similar abstraction in `ruff_linter::importer`. Both of them use the lower-level `ruff_python_importer::Insertion` primitive. The main differences here are: 1. This works with ty's semantic model...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/semantic_tokens.rs
crates/ty_ide/src/semantic_tokens.rs
//! This module walks the AST and collects a set of "semantic tokens" for a file //! or a range within a file. Each semantic token provides a "token type" and zero //! or more "modifiers". This information can be used by an editor to provide //! color coding based on semantic meaning. //! //! Visual Studio has a very u...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/references.rs
crates/ty_ide/src/references.rs
//! This module implements the core functionality of the "references", //! "document highlight" and "rename" language server features. It locates //! all references to a named symbol. Unlike a simple text search for the //! symbol's name, this is a "semantic search" where the text and the semantic //! meaning must matc...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/selection_range.rs
crates/ty_ide/src/selection_range.rs
use ruff_db::files::File; use ruff_db::parsed::parsed_module; use ruff_python_ast::find_node::covering_node; use ruff_text_size::{Ranged, TextRange, TextSize}; use crate::Db; /// Returns a list of nested selection ranges, where each range contains the next one. /// The first range in the list is the largest range con...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
false
astral-sh/ruff
https://github.com/astral-sh/ruff/blob/8464aca795bc3580ca15fcb52b21616939cea9a9/crates/ty_ide/src/inlay_hints.rs
crates/ty_ide/src/inlay_hints.rs
use std::{fmt, vec}; use crate::{Db, HasNavigationTargets, NavigationTarget}; use ruff_db::files::File; use ruff_db::parsed::parsed_module; use ruff_python_ast::visitor::source_order::{self, SourceOrderVisitor, TraversalSignal}; use ruff_python_ast::{AnyNodeRef, ArgOrKeyword, Expr, ExprUnaryOp, Stmt, UnaryOp}; use ruf...
rust
MIT
8464aca795bc3580ca15fcb52b21616939cea9a9
2026-01-04T15:31:59.413821Z
true