repo stringclasses 183
values | ref stringlengths 40 40 | path stringlengths 8 198 | prompt stringlengths 0 24.6k | suffix stringlengths 0 24.5k | canonical_solution stringlengths 30 18.1k | lang stringclasses 12
values | timestamp timestamp[s]date 2019-12-19 23:00:04 2025-03-02 18:12:33 |
|---|---|---|---|---|---|---|---|
Homebrew/brew | 3e8709e4da0585cb94040dd3fea9a779d7214c7e | Library/Homebrew/utils/tty.rb | # typed: strict
# frozen_string_literal: true
# Various helper functions for interacting with TTYs.
module Tty
@stream = T.let($stdout, T.nilable(T.any(IO, StringIO)))
COLOR_CODES = T.let(
{
red: 31,
green: 32,
yellow: 33,
blue: 34,
magenta: 35,
cyan: 36,
... |
sig { params(line_count: Integer).returns(String) }
def move_cursor_down(line_count)
"\033[#{line_count}B"
end
sig { returns(String) }
def clear_to_end
"\033[K"
end
sig { returns(String) }
def hide_cursor
"\033[?25l"
end
sig { returns(String) }
def show... | sig { returns(String) }
def move_cursor_beginning
"\033[0G"
end | ruby | 2025-02-01T14:24:11 |
Homebrew/brew | fed5321969e1afee30b2202be61859ab45637780 | Library/Homebrew/utils/bottles.rb | # typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
require "tab"
module Utils
# Helper functions for bottles.
#
# @api internal
module Bottles
class << self
# Gets the tag for the running OS.
#
# @api internal
sig { params(tag: T.nilable(T.any(Symbol, Tag... |
end
end
end
# The specification for a specific tag
class TagSpecification
sig { returns(Utils::Bottles::Tag) }
attr_reader :tag
sig { returns(Checksum) }
attr_reader :checksum
sig { returns(T.any(Symbol, String)) }
attr_reader :cellar
def initiali... | end
end
private
sig { params(arch: Symbol).returns(Symbol) }
def arch_to_symbol(arch)
if system == :all && arch == :all
:all
elsif macos? && standardized_arch == :x86_64
system
else
:"#{arch}_#{system}" | ruby | 2025-01-31T21:54:41 |
Homebrew/brew | 7b014422738dcd5c8428b606d5429223371c87d1 | Library/Homebrew/test/rubocops/disable_comment_spec.rb | # frozen_string_literal: true
require "rubocops/disable_comment"
RSpec.describe RuboCop::Cop::DisableComment, :config do
shared_examples "offense" do |source, correction, message|
it "registers an offense and corrects" do
expect_offense(<<~RUBY, source:, message:)
#{source}
^{source} #{mes... |
it "doesn't register an offense" do
expect_no_offenses(<<~RUBY)
def something; end
# This is a upstream name that we cannot change.
# rubocop:disable Naming/AccessorMethodName
def get_decrypted_io; end
RUBY
end
end
| it "registers an offense if the comment is empty" do
expect_offense(<<~RUBY)
def something; end
#
# rubocop:disable Naming/AccessorMethodName
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Add a clarifying comment to the RuboCop disable comment
def get_decrypted_io; end
RUBY
end | ruby | 2025-01-31T19:37:00 |
Homebrew/brew | 4acdcfcb3729efa32785564d8ea0d24fbd92f18e | Library/Homebrew/rubocops/all.rb | # typed: strict
# frozen_string_literal: true
require_relative "../extend/array"
require_relative "../extend/blank"
require_relative "blank"
require_relative "compact_blank"
|
require_relative "extend/mutable_constant_exclude_unfreezable"
require_relative "io_read"
require_relative "move_to_extend_os"
require_relative "negate_include"
require_relative "no_fileutils_rmrf"
require_relative "presence"
require_relative "present"
require_relative "safe_navigation_with_blank"
require_relative "sh... | require_relative "disable_comment" | ruby | 2024-11-21T14:20:36 |
Homebrew/brew | cff9a565b68e6e32b3e9f1903b0507193fd5b87d | Library/Homebrew/formula_creator.rb | # typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
require "digest"
require "erb"
module Homebrew
# Class for generating a formula from a template.
class FormulaCreator
attr_accessor :name
sig {
params(name: T.nilable(String), version: T.nilable(String), tap: T.nilable(St... |
system "gem", "build", "\#{name}.gemspec"
system "gem", "install", "\#{name}-\#{version}.gem"
bin.install libexec/"bin/\#{name}"
bin.env_script_all_files(libexec/"bin", GEM_HOME: ENV["GEM_HOME"])
<% elsif @mode == :rust %>
system "cargo", "install", *... | system "bundle", "config", "set", "without", "development", "test"
system "bundle", "install" | ruby | 2025-01-30T10:22:22 |
Homebrew/brew | 867e9823003be62bf30accdc4e87ccb69b98dc3d | Library/Homebrew/rubocops/cask/ast/stanza.rb | # typed: strict
# frozen_string_literal: true
require "forwardable"
module RuboCop
module Cask
module AST
# This class wraps the AST send/block node that encapsulates the method
# call that comprises the stanza. It includes various helper methods to
# aid cops in their analysis.
class St... |
T.cast(stanza_node, RuboCop::AST::SendNode).method_name
end
sig { returns(T.nilable(T::Array[Symbol])) }
def stanza_group
Constants::STANZA_GROUP_HASH[stanza_name]
end
sig { returns(T.nilable(Integer)) }
def stanza_index
Constants::STANZA... | return stanza_node.method_node&.method_name if stanza_node.block_type? | ruby | 2025-01-25T21:35:21 |
Homebrew/brew | 9a97456767edaa6b949a55f95f92a989484d75cf | Library/Homebrew/rubocops/cask/discontinued.rb | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
# This cop corrects `caveats { discontinued }` to `deprecate!`.
class Discontinued < Base
include CaskHelp
extend AutoCorrector
MESSAGE = "Use `deprecate!` instead of `caveats { discontinued }... |
def on_cask_stanza_block(stanza_block)
stanza_block.stanzas.select(&:caveats?).each do |stanza|
find_discontinued_method_call(stanza.stanza_node) do |node|
if caveats_contains_only_discontinued?(node.parent)
add_offense(node.parent, message: MESSAGE) do |corr... | sig { override.params(stanza_block: RuboCop::Cask::AST::StanzaBlock).void } | ruby | 2025-01-22T23:17:22 |
Homebrew/brew | 9a97456767edaa6b949a55f95f92a989484d75cf | Library/Homebrew/rubocops/cask/extend/node.rb | # typed: strict
# frozen_string_literal: true
module RuboCop
module AST
# Extensions for RuboCop's AST Node class.
class Node
include RuboCop::Cask::Constants
def_node_matcher :method_node, "{$(send ...) (block $(send ...) ...)}"
def_node_matcher :block_body, "(block _ _ $_)"
def_no... |
def location_expression
base_expression = loc.expression
descendants.select(&:heredoc?).reduce(base_expression) do |expr, node|
expr.join(node.loc.heredoc_end)
end
end
end
end
end
| sig { returns(Parser::Source::Range) } | ruby | 2025-01-22T23:17:22 |
Homebrew/brew | 9a97456767edaa6b949a55f95f92a989484d75cf | Library/Homebrew/rubocops/cask/mixin/on_desc_stanza.rb | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
# Common functionality for checking desc stanzas.
module OnDescStanza
extend Forwardable
include CaskHelp
|
def on_cask(cask_block)
@cask_block = T.let(cask_block, T.nilable(RuboCop::Cask::AST::CaskBlock))
toplevel_stanzas.select(&:desc?).each do |stanza|
on_desc_stanza(stanza)
end
end
private
sig { returns(T.nilable(RuboCop::Cask::AST::CaskBlock))... | sig { override.params(cask_block: T.nilable(RuboCop::Cask::AST::CaskBlock)).void } | ruby | 2025-01-22T23:17:22 |
Homebrew/brew | 9a97456767edaa6b949a55f95f92a989484d75cf | Library/Homebrew/rubocops/cask/mixin/on_homepage_stanza.rb | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
# Common functionality for checking homepage stanzas.
module OnHomepageStanza
extend Forwardable
include CaskHelp
|
def on_cask(cask_block)
@cask_block = T.let(cask_block, T.nilable(RuboCop::Cask::AST::CaskBlock))
toplevel_stanzas.select(&:homepage?).each do |stanza|
on_homepage_stanza(stanza)
end
end
private
sig { returns(T.nilable(RuboCop::Cask::AST::Cas... | sig { override.params(cask_block: T.nilable(RuboCop::Cask::AST::CaskBlock)).void } | ruby | 2025-01-22T23:17:22 |
Homebrew/brew | 9a97456767edaa6b949a55f95f92a989484d75cf | Library/Homebrew/rubocops/cask/url.rb | # typed: strict
# frozen_string_literal: true
require "rubocops/shared/url_helper"
module RuboCop
module Cop
module Cask
# This cop checks that a cask's `url` stanza is formatted correctly.
#
# ### Example
#
# ```ruby
# # bad
# url "https://example.com/download/foo.dmg"... |
def on_url_stanza(stanza)
if stanza.stanza_node.block_type?
if cask_tap == "homebrew-cask"
add_offense(stanza.stanza_node, message: 'Do not use `url "..." do` blocks in Homebrew/homebrew-cask.')
end
return
end
url_stanza = stanza.... | sig { params(stanza: RuboCop::Cask::AST::Stanza).void } | ruby | 2025-01-22T23:17:22 |
Homebrew/brew | 9a97456767edaa6b949a55f95f92a989484d75cf | Library/Homebrew/rubocops/cask/variables.rb | # typed: strict
# frozen_string_literal: true
require "forwardable"
module RuboCop
module Cop
module Cask
# This cop audits variables in casks.
#
# ### Example
#
# ```ruby
# # bad
# cask do
# arch = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"
# end
... |
def on_cask(cask_block)
@cask_block = T.let(cask_block, T.nilable(RuboCop::Cask::AST::CaskBlock))
add_offenses
end
private
def_delegator :@cask_block, :cask_node
sig { void }
def add_offenses
variable_assignment(cask_node) do |node, var_n... | sig { override.params(cask_block: RuboCop::Cask::AST::CaskBlock).void } | ruby | 2025-01-22T23:17:22 |
Homebrew/brew | 9cc9dd8760eb717909622bd961f8f12193fc2c48 | Library/Homebrew/dev-cmd/tests.rb | # typed: strict
# frozen_string_literal: true
require "abstract_command"
require "fileutils"
require "hardware"
require "system_command"
module Homebrew
module DevCmd
class Tests < AbstractCommand
include SystemCommand::Mixin
cmd_args do
description <<~EOS
Run Homebrew's unit and ... |
# TODO: remove this and fix tests when possible.
ENV["HOMEBREW_NO_INSTALL_FROM_API"] = "1"
ENV.delete("HOMEBREW_INTERNAL_JSON_V3")
ENV["USER"] ||= system_command!("id", args: ["-nu"]).stdout.chomp
# Avoid local configuration messing with tests, e.g. git being configured
... | ENV["HOMEBREW_NO_FORCE_BREW_WRAPPER"] = "1" | ruby | 2025-01-23T16:06:23 |
Homebrew/brew | fa8ada31b88088e05f8438b3ed04337a470d0971 | Library/Homebrew/cleanup.rb | # typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
require "utils/bottles"
require "attrable"
require "formula"
require "cask/cask_loader"
module Homebrew
# Helper class for cleaning up the Homebrew cache.
class Cleanup
CLEANUP_DEFAULT_DAYS = Homebrew::EnvConfig.cleanup_periodic_fu... |
sig { params(pathname: Pathname, scrub: T::Boolean).returns(T::Boolean) }
def stale_formula?(pathname, scrub)
return false unless HOMEBREW_CELLAR.directory?
version = if HOMEBREW_BOTTLES_EXTNAME_REGEX.match?(to_s)
begin
Utils::Bottles.resolve_version(pathname).to_s
... | sig { params(formula: Formula).returns(T::Set[String]) }
def excluded_versions_from_cleanup(formula)
@excluded_versions_from_cleanup ||= {}
@excluded_versions_from_cleanup[formula.name] ||= begin
eligible_kegs_for_cleanup = formula.eligible_kegs_for_cleanup(quiet: true)
Set.new... | ruby | 2025-01-23T14:45:17 |
Homebrew/brew | fa8ada31b88088e05f8438b3ed04337a470d0971 | Library/Homebrew/test/cleanup_spec.rb | # frozen_string_literal: true
require "test/support/fixtures/testball"
require "cleanup"
require "cask/cache"
require "fileutils"
RSpec.describe Homebrew::Cleanup do
subject(:cleanup) { described_class.new }
let(:ds_store) { Pathname.new("#{HOMEBREW_CELLAR}/.DS_Store") }
let(:lock_file) { Pathname.new("#{HOMEB... |
FileUtils.touch(CoreTap.instance.new_formula_path("testball"))
end
it "cleans up file if outdated" do
allow(Utils::Bottles).to receive(:file_outdated?).with(any_args).and_return(true)
cleanup.cleanup_cache
expect(bottle).not_to exist
expect(testball).not_to exist
... | # Create the latest version of testball so the older version is eligible for cleanup.
(HOMEBREW_CELLAR/"testball"/"0.1/bin").mkpath | ruby | 2025-01-23T14:45:17 |
Homebrew/brew | b49625a7dc19517289764df0b2e1dc5671dd490e | Library/Homebrew/cmd/install.rb | # typed: strict
# frozen_string_literal: true
require "abstract_command"
require "cask/config"
require "cask/installer"
require "cask_dependent"
require "missing_formula"
require "formula_installer"
require "development_tools"
require "install"
require "cleanup"
require "upgrade"
module Homebrew
module Cmd
clas... |
[:flag, "--bottle-arch=", {
depends_on: "--build-bottle",
description: "Optimise bottles for the specified architecture rather than the oldest " \
"architecture supported by the version of macOS the bottles are built on.",
}],
[:switch, "-... | [:switch, "--skip-link", {
description: "Install but skip linking the keg into the prefix.",
}], | ruby | 2025-01-23T14:42:03 |
Homebrew/brew | c34b71655c16aeeb49ff1415e7edcd09b55da955 | Library/Homebrew/cask/installer.rb | # typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
require "attrable"
require "formula_installer"
require "unpack_strategy"
require "utils/topological_hash"
require "cask/config"
require "cask/download"
require "cask/migrator"
require "cask/quarantine"
require "cask/tab"
require "cgi"
mod... |
def extract_primary_container(to: @cask.staged_path)
odebug "Extracting primary container"
odebug "Using container class #{primary_container.class} for #{primary_container.path}"
basename = downloader.basename
if (nested_container = @cask.container&.nested)
Dir.mktmpdir("cask-ins... | sig { returns(ArtifactSet) }
def artifacts
@cask.artifacts
end
sig { params(to: Pathname).void } | ruby | 2024-12-04T21:49:14 |
Homebrew/brew | c34b71655c16aeeb49ff1415e7edcd09b55da955 | Library/Homebrew/extend/os/linux/cask/installer.rb | # typed: strict
# frozen_string_literal: true
module OS
module Linux
module Cask
module Installer
private
extend T::Helpers
requires_ancestor { ::Cask::Installer }
sig { void }
def check_stanza_os_requirements
|
raise ::Cask::CaskError, "macOS is required for this software."
end
end
end
end
end
Cask::Installer.prepend(OS::Linux::Cask::Installer)
| return if artifacts.all?(::Cask::Artifact::Font) | ruby | 2024-12-04T21:49:14 |
Homebrew/brew | c34b71655c16aeeb49ff1415e7edcd09b55da955 | Library/Homebrew/os/linux.rb | # typed: strict
# frozen_string_literal: true
require "utils"
module OS
# Helper module for querying system information on Linux.
module Linux
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
# This check is the only acceptable or necessary one in this file.
# rubocop:disabl... |
end
end
end
| end
sig { returns(T::Array[String]) }
def self.languages
return @languages if @languages.present?
os_langs = Utils.popen_read("localectl", "list-locales")
os_langs = os_langs.scan(/[^ \n"(),]+/).map { |item| item.split(".").first.tr("_", "-") }
@languages = os_langs | ruby | 2024-12-04T21:49:14 |
Homebrew/brew | c34b71655c16aeeb49ff1415e7edcd09b55da955 | Library/Homebrew/os/mac.rb | # typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
require "macos_version"
require "os/mac/xcode"
require "os/mac/sdk"
require "os/mac/keg"
module OS
# Helper module for querying system information on macOS.
module Mac
raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GEN... |
def self.languages
return @languages if @languages
os_langs = Utils.popen_read("defaults", "read", "-g", "AppleLanguages")
if os_langs.blank?
# User settings don't exist so check the system-wide one.
os_langs = Utils.popen_read("defaults", "read", "/Library/Preferences/.GlobalPre... | sig { returns(T::Array[String]) } | ruby | 2024-12-04T21:49:14 |
Homebrew/brew | 69e9f60da879e65753a472bff52462fb5c696c7d | Library/Homebrew/build_environment.rb | # typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
# Settings for the build environment.
class BuildEnvironment
sig { params(settings: Symbol).void }
def initialize(*settings)
@settings = Set.new(settings)
end
sig { params(args: T::Enumerable[Symbol]).returns(T.self_type) }
de... |
HOMEBREW_SVN HOMEBREW_GIT
HOMEBREW_SDKROOT
MAKE GIT CPP
ACLOCAL_PATH PATH CPATH
LD_LIBRARY_PATH LD_RUN_PATH LD_PRELOAD LIBRARY_PATH
].freeze
private_constant :KEYS
sig { params(env: T::Hash[String, T.nilable(T.any(String, Pathname))]).returns(T::Array[String]) }
def self.keys(env)
KEYS... | all_proxy ftp_proxy http_proxy https_proxy no_proxy | ruby | 2025-01-13T19:35:31 |
Homebrew/brew | 450469f57f4c20d19dd5691728631434300a64df | Library/Homebrew/github_packages.rb | # typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
require "utils/curl"
require "utils/gzip"
require "json"
require "zlib"
require "extend/hash/keys"
require "system_command"
# GitHub Packages client.
class GitHubPackages
include Context
include SystemCommand::Mixin
URL_DOMAIN = "ghc... |
formula_name, org, repo, version, rebuild, version_rebuild, image_name, image_uri, keep_old = *result
root = Pathname("#{formula_name}--#{version_rebuild}")
FileUtils.rm_rf root
root.mkpath
if keep_old
download(user, token, skopeo, image_uri, root, dry_run:)
else
write_image_layo... | # Skip upload if preupload check returned early.
return if result.nil? | ruby | 2025-01-11T00:25:00 |
Homebrew/brew | 268f801038c756686a25ef533e28f246cf33dd18 | Library/Homebrew/utils/inreplace.rb | # typed: strict
# frozen_string_literal: true
require "utils/string_inreplace_extension"
module Utils
# Helper functions for replacing text in files in-place.
module Inreplace
# Error during text replacement.
class Error < RuntimeError
sig { params(errors: T::Hash[String, T::Array[String]]).void }
... |
def self.inreplace_pairs(path, replacement_pairs, read_only_run: false, silent: false)
str = File.binread(path)
contents = StringInreplaceExtension.new(str)
replacement_pairs.each do |old, new|
if old.blank?
contents.errors << "No old value for new value #{new}! Did you pass the... | sig {
params(
path: T.any(String, Pathname),
replacement_pairs: T::Array[[T.any(Regexp, Pathname, String), T.any(Pathname, String)]],
read_only_run: T::Boolean,
silent: T::Boolean,
).returns(String)
} | ruby | 2025-01-06T00:12:03 |
Homebrew/brew | 268f801038c756686a25ef533e28f246cf33dd18 | Library/Homebrew/utils/repology.rb | # typed: strict
# frozen_string_literal: true
require "utils/curl"
# Repology API client.
module Repology
HOMEBREW_CORE = "homebrew"
HOMEBREW_CASK = "homebrew_casks"
MAX_PAGINATION = 15
private_constant :MAX_PAGINATION
sig { params(last_package_in_response: T.nilable(String), repository: String).returns(T:... |
def self.parse_api_response(limit = nil, last_package = "", repository:)
package_term = case repository
when HOMEBREW_CORE
"formulae"
when HOMEBREW_CASK
"casks"
else
"packages"
end
ohai "Querying outdated #{package_term} from Repology"
page_no = 1
outdated_packages... | sig {
params(
limit: T.nilable(Integer),
last_package: T.nilable(String),
repository: String,
).returns(T::Hash[String, T.untyped])
} | ruby | 2025-01-06T00:12:03 |
Homebrew/brew | e9b4979f40fd142f98ce3206abe103c9ddc3714a | Library/Homebrew/startup/config.rb | # typed: true
# frozen_string_literal: true
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
# Path to `bin/brew` main executable in `HOMEBREW_PREFIX`
|
HOMEBREW_BREW_FILE = Pathname(ENV.fetch("HOMEBREW_BREW_FILE")).freeze
# Where we link under
HOMEBREW_PREFIX = Pathname(ENV.fetch("HOMEBREW_PREFIX")).freeze
# Where `.git` is found
HOMEBREW_REPOSITORY = Pathname(ENV.fetch("HOMEBREW_REPOSITORY")).freeze
# Where we store most of Homebrew, taps and various metadata
HOM... | # Used for e.g. permissions checks.
HOMEBREW_ORIGINAL_BREW_FILE = Pathname(ENV.fetch("HOMEBREW_ORIGINAL_BREW_FILE")).freeze
# Path to the executable that should be used to run `brew`.
# This may be HOMEBREW_ORIGINAL_BREW_FILE or HOMEBREW_BREW_WRAPPER. | ruby | 2025-01-07T17:40:18 |
Homebrew/brew | e9b4979f40fd142f98ce3206abe103c9ddc3714a | Library/Homebrew/test/support/lib/startup/config.rb | # typed: true
# frozen_string_literal: true
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
|
HOMEBREW_BREW_FILE = Pathname.new(ENV.fetch("HOMEBREW_BREW_FILE")).freeze
TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") do |k|
dir = Dir.mktmpdir("homebrew-tests-", ENV.fetch("HOMEBREW_TEMP"))
at_exit do
# Child processes inherit this at_exit handler, but we don't want them
# to clean TEST_TMPDIR up pre... | HOMEBREW_ORIGINAL_BREW_FILE = Pathname.new(ENV.fetch("HOMEBREW_ORIGINAL_BREW_FILE")).freeze | ruby | 2025-01-07T17:40:18 |
Homebrew/brew | 94085ebb570805865ba28cdf80f0b1e3494ef009 | Library/Homebrew/rubocops/cask/desc.rb | # typed: strict
# frozen_string_literal: true
require "rubocops/cask/mixin/on_desc_stanza"
require "rubocops/shared/desc_helper"
module RuboCop
module Cop
module Cask
# This cop audits `desc` in casks.
# See the {DescHelper} module for details of the checks.
class Desc < Base
include O... |
def on_desc_stanza(stanza)
@name = T.let(cask_block.header.cask_token, T.nilable(String))
desc_call = stanza.stanza_node
audit_desc(:cask, @name, desc_call)
end
end
end
end
end
| sig { params(stanza: RuboCop::Cask::AST::Stanza).void } | ruby | 2025-01-05T23:45:23 |
Homebrew/brew | 94085ebb570805865ba28cdf80f0b1e3494ef009 | Library/Homebrew/rubocops/cask/homepage_url_styling.rb | # typed: strict
# frozen_string_literal: true
require "forwardable"
require "uri"
require "rubocops/shared/homepage_helper"
module RuboCop
module Cop
module Cask
# This cop audits the `homepage` URL in casks.
class HomepageUrlStyling < Base
include OnHomepageStanza
include HelperFunc... |
def on_homepage_stanza(stanza)
@name = T.let(cask_block.header.cask_token, T.nilable(String))
desc_call = stanza.stanza_node
url_node = desc_call.first_argument
url = if url_node.dstr_type?
# Remove quotes from interpolated string.
url_node.sourc... | sig { params(stanza: RuboCop::Cask::AST::Stanza).void } | ruby | 2025-01-05T23:45:23 |
Homebrew/brew | 94085ebb570805865ba28cdf80f0b1e3494ef009 | Library/Homebrew/rubocops/cask/mixin/on_url_stanza.rb | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
# Common functionality for checking url stanzas.
module OnUrlStanza
extend Forwardable
include CaskHelp
|
def on_cask(cask_block)
@cask_block = T.let(cask_block, T.nilable(RuboCop::Cask::AST::CaskBlock))
toplevel_stanzas.select(&:url?).each do |stanza|
on_url_stanza(stanza)
end
end
private
sig { returns(T.nilable(RuboCop::Cask::AST::CaskBlock)) }... | sig { override.params(cask_block: T.nilable(RuboCop::Cask::AST::CaskBlock)).void } | ruby | 2025-01-05T23:45:23 |
Homebrew/brew | 94085ebb570805865ba28cdf80f0b1e3494ef009 | Library/Homebrew/rubocops/cask/on_system_conditionals.rb | # typed: strict
# frozen_string_literal: true
require "forwardable"
require "rubocops/shared/on_system_conditionals_helper"
module RuboCop
module Cop
module Cask
# This cop makes sure that OS conditionals are consistent.
#
# ### Example
#
# ```ruby
# # bad
# cask 'foo' ... |
def on_cask(cask_block)
@cask_block = T.let(cask_block, T.nilable(RuboCop::Cask::AST::CaskBlock))
toplevel_stanzas.each do |stanza|
next unless FLIGHT_STANZA_NAMES.include? stanza.stanza_name
audit_on_system_blocks(stanza.stanza_node, stanza.stanza_name)
... | sig { override.params(cask_block: RuboCop::Cask::AST::CaskBlock).void } | ruby | 2025-01-05T23:45:23 |
Homebrew/brew | 94085ebb570805865ba28cdf80f0b1e3494ef009 | Library/Homebrew/rubocops/cask/url_legacy_comma_separators.rb | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
# This cop checks for `version.before_comma` and `version.after_comma`.
class UrlLegacyCommaSeparators < Url
include OnUrlStanza
extend AutoCorrector
MSG_CSV = "Use `version.csv.first` instead... |
def on_url_stanza(stanza)
return if stanza.stanza_node.type == :block
url_node = stanza.stanza_node.first_argument
legacy_comma_separator_pattern = /version\.(before|after)_comma/
url = url_node.source
return unless url.match?(legacy_comma_separator_pattern... | sig { override.params(stanza: RuboCop::Cask::AST::Stanza).void } | ruby | 2025-01-05T23:45:23 |
Homebrew/brew | 94085ebb570805865ba28cdf80f0b1e3494ef009 | Library/Homebrew/rubocops/no_fileutils_rmrf.rb | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# This cop checks for the use of `FileUtils.rm_f`, `FileUtils.rm_rf`, or `{FileUtils,instance}.rmtree`
# and recommends the safer versions.
class NoFileutilsRmrf < Base
extend AutoCorrector
... |
def neither_rm_rf_nor_rmtree?(node)
!any_receiver_rm_r_f?(node) && !no_receiver_rm_r_f?(node) &&
!any_receiver_rmtree?(node) && !no_receiver_rmtree?(node)
end
end
end
end
end
| sig { params(node: RuboCop::AST::SendNode).returns(T::Boolean) } | ruby | 2025-01-05T23:45:23 |
IBM/sarama | 6182e9e92a3ed01fe2692ebeb9fa330320c6dba6 | utils.go | package sarama
import (
"bufio"
"fmt"
"net"
"regexp"
)
type none struct{}
// make []int32 sortable so we can sort partition numbers
type int32Slice []int32
func (slice int32Slice) Len() int {
return len(slice)
}
func (slice int32Slice) Less(i, j int) bool {
return slice[i] < slice[j]
}
func (slice int32Slic... |
V3_8_0_0 = newKafkaVersion(3, 8, 0, 0)
V3_8_1_0 = newKafkaVersion(3, 8, 1, 0)
V3_9_0_0 = newKafkaVersion(3, 9, 0, 0)
V4_0_0_0 = newKafkaVersion(4, 0, 0, 0)
SupportedVersions = []KafkaVersion{
V0_8_2_0,
V0_8_2_1,
V0_8_2_2,
V0_9_0_0,
V0_9_0_1,
V0_10_0_0,
V0_10_0_1,
V0_10_1_0,
V0_10_1_1,
V0_... | V3_7_2_0 = newKafkaVersion(3, 7, 2, 0) | go | 2025-01-09T12:48:30 |
IBM/sarama | 060bb3f8da230bb60f00c5de51bc21ce8d7bfa91 | functional_admin_test.go | //go:build functional
package sarama
import (
"context"
"testing"
"github.com/davecgh/go-spew/spew"
)
func TestFuncAdminQuotas(t *testing.T) {
checkKafkaVersion(t, "2.6.0.0")
setupFunctionalTest(t)
defer teardownFunctionalTest(t)
kafkaVersion, err := ParseKafkaVersion(FunctionalTestEnv.KafkaVersion)
if err... | func TestFuncAdminListConsumerGroupOffsets(t *testing.T) {
checkKafkaVersion(t, "0.8.2.0")
setupFunctionalTest(t)
defer teardownFunctionalTest(t)
config := NewFunctionalTestConfig()
config.ClientID = t.Name()
client, err := NewClient(FunctionalTestEnv.KafkaBrokerAddrs, config)
defer safeClose(t, client)
if err... | go | 2025-01-05T11:52:58 | |
IBM/sarama | 75660e5fe225ef2e0dc2ded34cd7050d2be63f3d | create_topics_request.go | package sarama
import (
"time"
)
type CreateTopicsRequest struct {
// Version defines the protocol version to use for encode and decode
Version int16
// TopicDetails contains the topics to create.
TopicDetails map[string]*TopicDetail
// Timeout contains how long to wait before timing out the request.
Timeout t... |
func (c *CreateTopicsRequest) encode(pe packetEncoder) error {
if err := pe.putArrayLength(len(c.TopicDetails)); err != nil {
return err
}
for topic, detail := range c.TopicDetails {
if err := pe.putString(topic); err != nil {
return err
}
if err := detail.encode(pe); err != nil {
return err
}
}
... | func NewCreateTopicsRequest(version KafkaVersion, topicDetails map[string]*TopicDetail, timeout time.Duration) *CreateTopicsRequest {
r := &CreateTopicsRequest{
TopicDetails: topicDetails,
Timeout: timeout,
}
if version.IsAtLeast(V2_0_0_0) {
r.Version = 3
} else if version.IsAtLeast(V0_11_0_0) {
r.Vers... | go | 2025-01-06T10:13:14 |
IBM/sarama | 75660e5fe225ef2e0dc2ded34cd7050d2be63f3d | delete_topics_request.go | package sarama
import "time"
type DeleteTopicsRequest struct {
Version int16
Topics []string
Timeout time.Duration
}
|
func (d *DeleteTopicsRequest) encode(pe packetEncoder) error {
if err := pe.putStringArray(d.Topics); err != nil {
return err
}
pe.putInt32(int32(d.Timeout / time.Millisecond))
return nil
}
func (d *DeleteTopicsRequest) decode(pd packetDecoder, version int16) (err error) {
if d.Topics, err = pd.getStringArra... | func NewDeleteTopicsRequest(version KafkaVersion, topics []string, timeout time.Duration) *DeleteTopicsRequest {
d := &DeleteTopicsRequest{
Topics: topics,
Timeout: timeout,
}
if version.IsAtLeast(V2_1_0_0) {
d.Version = 3
} else if version.IsAtLeast(V2_0_0_0) {
d.Version = 2
} else if version.IsAtLeast(V... | go | 2025-01-06T10:13:14 |
IBM/sarama | 75660e5fe225ef2e0dc2ded34cd7050d2be63f3d | functional_consumer_test.go | //go:build functional
package sarama
import (
"context"
"errors"
"fmt"
"math"
"os"
"sort"
"strconv"
"strings"
"sync"
"testing"
"time"
"golang.org/x/sync/errgroup"
"github.com/rcrowley/go-metrics"
assert "github.com/stretchr/testify/require"
)
func TestFuncConsumerOffsetOutOfRange(t *testing.T) {
set... |
versions := make([]KafkaVersion, 0, len(fvtRangeVersions))
for _, v := range fvtRangeVersions {
if !v.IsAtLeast(lower) {
continue
}
if !upper.IsAtLeast(v) {
return versions
}
versions = append(versions, v)
}
return versions
}
func produceMsgs(t *testing.T, clientVersions []KafkaVersion, codecs []... | // KIP-896 dictates a minimum lower bound of 2.1 protocol for Kafka 4.0 onwards
if upper.IsAtLeast(V4_0_0_0) {
if !lower.IsAtLeast(V2_1_0_0) {
lower = V2_1_0_0
}
} | go | 2025-01-06T10:13:14 |
JetBrains/intellij-community | f8bcdd0baefe9f95e6e7701961ca46a1519d6364 | xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementContentGroupImpl.java | // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.impl.source.xml;
import com.intellij.openapi.util.NotNullLazyValue;
import com.intellij.psi.PsiElement;
import com.intellij.psi.tree.TokenSet;
import com... |
/**
* @author Dmitry Avdeev
*/
public final class XmlElementContentGroupImpl extends XmlElementImpl implements XmlElementContentGroup {
private final NotNullLazyValue<XmlContentParticle[]> myParticles = NotNullLazyValue.lazy(() -> {
return ContainerUtil.map(getChildren(TokenSet.create(XML_ELEMENT_CONTENT_GROU... | import static com.intellij.psi.xml.XmlElementType.XML_ELEMENT_CONTENT_GROUP;
import static com.intellij.psi.xml.XmlTokenType.XML_BAR;
import static com.intellij.psi.xml.XmlTokenType.XML_NAME; | java | 2025-02-03T21:57:26 |
JetBrains/intellij-community | d66580aa6f4d29af8e3a722e5589861c79535d56 | plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationProfileState.java | // Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.sh.run;
import com.intellij.execution.*;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.configurations.PtyCom... |
}
}
private static void addIfPresent(@NotNull List<String> commandLine, @Nullable String options) {
ContainerUtil.addIfNotNull(commandLine, StringUtil.nullize(options));
}
private static void addIfPresent(@NotNull List<String> commandLine, @NotNull Map<String, String> envs) {
addIfPresent(command... | }
}
private EelDescriptor computeEelDescriptor() {
EelDescriptor eelDescriptor = null;
if (!myRunConfiguration.getScriptWorkingDirectory().isEmpty()) {
eelDescriptor = nullizeIfLocal(getEelDescriptor(Path.of(myRunConfiguration.getScriptWorkingDirectory())));
}
if (eelDescriptor == null && !... | java | 2025-02-03T22:24:08 |
JetBrains/intellij-community | 44c25b2685dde466a105379d57768deea96ba9a9 | platform/platform-tests/testSrc/com/intellij/concurrency/suites.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.concurrency
import com.intellij.openapi.application.impl.*
import com.intellij.openapi.progress.*
import com.intellij.util.concurrency.*
import org.junit.platform.suite.api.Sele... |
// contexts
ContextSwitchTest::class,
BlockingContextTest::class,
ExistingThreadContextTest::class,
IndicatorThreadContextTest::class,
RunBlockingCancellableTest::class,
RunWithModalProgressBlockingTest::class,
WithModalProgressTest::class,
CoroutineToIndicatorTest::class,
CurrentThreadCoroutineS... | // general threading
NonBlockingReadActionTest::class,
ProgressRunnerTest::class,
EdtCoroutineDispatcherTest::class,
ImplicitReadTest::class,
LaterInvocatorTest::class,
ModalCoroutineTest::class,
ReadWritePropagationTest::class, | kotlin | 2025-02-03T15:25:38 |
JetBrains/intellij-community | 8a32b556a02ee5fd4e737e4cbc688ab07b90f9a6 | java/debugger/impl/src/com/intellij/debugger/ui/tree/render/BatchEvaluator.java | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.debugger.ui.tree.render;
import com.intellij.debugger.JavaDebuggerBundle;
import com.intellij.debugger.engine.*;
import com.intellij.debugger.engine.evaluation.EvaluateException... |
}
catch (EvaluateException e) {
ObjectReference exceptionFromTargetVM = e.getExceptionFromTargetVM();
if (exceptionFromTargetVM != null && "java.io.UTFDataFormatException".equals(exceptionFromTargetVM.referenceType().name())) {
// one of the strings is too long - just fall back to the regul... | }
catch (MethodNotFoundException e) {
if (IntelliJProjectUtil.isIntelliJPlatformProject(evaluationContext.getProject())) {
String runProfileName = null;
DebugProcessImpl debugProcess = (DebugProcessImpl)evaluationContext.getDebugProcess();
XDebugSession session = debugProcess.getSessio... | java | 2025-02-03T17:19:29 |
JetBrains/intellij-community | 7f36210e7c3bb5d66d0fdfc6930fe5b2a270b4e0 | plugins/kotlin/project-wizard/idea/src/org/jetbrains/kotlin/tools/projectWizard/IntelliJKotlinNewProjectWizardData.kt | // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.tools.projectWizard
import com.intellij.ide.projectWizard.generators.IntelliJNewProjectWizardData
import com.intellij.ide.wizard.NewProjectWizardStep
import com.intellij... |
companion object {
val KEY = Key.create<IntelliJKotlinNewProjectWizardData>(IntelliJKotlinNewProjectWizardData::class.java.name)
@JvmStatic
val NewProjectWizardStep.kotlinData: IntelliJKotlinNewProjectWizardData?
get() = data.getUserData(KEY)
}
} | @Deprecated("Use addSampleCodeProperty instead")
override val generateOnboardingTipsProperty: ObservableMutableProperty<Boolean>
get() = addSampleCodeProperty
@Deprecated("Use addSampleCode instead")
override val generateOnboardingTips: Boolean
get() = addSampleCode | kotlin | 2025-01-31T13:09:22 |
JetBrains/intellij-community | 9dd2797ff8b76c97f38675ab989099597a243219 | platform/platform-tests/testSrc/com/intellij/openapi/progress/RunWithModalProgressBlockingTest.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.progress
import com.intellij.concurrency.TestElement
import com.intellij.concurrency.TestElementKey
import com.intellij.concurrency.currentThreadOverriddenContextOrNull
... |
}
}
}
}
}
}
}
private fun CoroutineScope.runWithModalProgressBlockingCoroutine(action: suspend CoroutineScope.() -> Unit): Job {
return launch(Dispatchers.EDT) {
blockingContext {
runWithModalProgressBlocking(action)
}
}
}
private suspend fun <T> runWithMod... | }
}
}
}
}
}
@Suppress("ForbiddenInSuspectContextMethod")
@Test
fun `simultaneous wa and ra are forbidden`(): Unit = timeoutRunBlocking(context = Dispatchers.EDT) {
val writeActionCounter = AtomicInteger(0)
writeIntentReadAction {
runWithModalProgressBlocking {
... | kotlin | 2025-01-24T16:09:28 |
JetBrains/intellij-community | 3059772b6c1e9e5df768750ed3b52904e5718490 | platform/platform-tests/testSrc/com/intellij/openapi/progress/RunWithModalProgressBlockingTest.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.progress
import com.intellij.concurrency.TestElement
import com.intellij.concurrency.TestElementKey
import com.intellij.concurrency.currentThreadOverriddenContextOrNull
... |
private suspend fun blockingContextTest() {
val contextModality = requireNotNull(currentCoroutineContext().contextModality())
blockingContext {
assertSame(contextModality, ModalityState.defaultModalityState())
runBlockingCancellable {
progressManagerTest {
val nestedModality =... | @Suppress("ForbiddenInSuspectContextMethod")
@Test
fun `background wa is permitted`(): Unit = timeoutRunBlocking {
// we test the absence of deadlocks here
withContext(Dispatchers.EDT) {
writeIntentReadAction {
runWithModalProgressBlocking {
ApplicationManager.getApplication().runWri... | kotlin | 2025-01-24T13:42:01 |
JetBrains/intellij-community | 44b0a44797333cfb21c197a98cccd834ba051e3b | plugins/textmate/core/src/org/jetbrains/plugins/textmate/regex/TextMateString.kt | package org.jetbrains.plugins.textmate.regex
import java.nio.ByteBuffer
import java.nio.CharBuffer
class TextMateString private constructor(val bytes: ByteArray) {
val id: Any = Any()
companion object {
fun fromString(string: String): TextMateString {
return TextMateString(string.toByteArray(Charsets.U... |
override fun hashCode(): Int {
return bytes.contentHashCode()
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as TextMateString
return bytes.contentEquals(other.bytes)
}
}
| fun charRangeByByteRange(byteRange: TextMateRange): TextMateRange {
val startOffset = charOffsetByByteOffset(bytes, 0, byteRange.start)
val endOffset = startOffset + charOffsetByByteOffset(bytes, byteRange.start, byteRange.end)
return TextMateRange(startOffset, endOffset)
}
private fun charOffsetByByte... | kotlin | 2025-01-21T13:30:55 |
JetBrains/intellij-community | 09b3fbf1b8c16a69b3a76775cc326411f5dfe800 | python/pydevSrc/src/com/jetbrains/python/debugger/PyDebugUtils.kt | // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.debugger
interface AbstractPolicy
fun interface PolicyListener {
fun valuesPolicyUpdated()
}
enum class ValuesPolicy : AbstractPolicy {
SYNC,
ASYNC,
ON_DEMAN... |
fun getQuotingString(policy: QuotingPolicy, value: String): String =
when (policy) {
QuotingPolicy.SINGLE -> value
QuotingPolicy.DOUBLE -> value.replace("'", "\"")
QuotingPolicy.NONE -> value.replace("'", "")
} | object NodeTypes {
const val ARRAY_NODE_TYPE: String = "array"
const val DICT_NODE_TYPE: String = "dict"
const val LIST_NODE_TYPE: String = "list"
const val TUPLE_NODE_TYPE: String = "tuple"
const val SET_NODE_TYPE: String = "set"
const val MATRIX_NODE_TYPE: String = "matrix"
const val NDARRAY_NODE_TYPE: ... | kotlin | 2025-01-31T15:00:49 |
JetBrains/intellij-community | 6a7e677ac8a78f347cd0e19b47bfe34290ccfffe | python/helpers/pydev/_pydevd_bundle/tables/pydevd_numpy_based.py | # Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
import numpy as np
import io
import base64
try:
import tensorflow as tf
except ImportError:
pass
try:
import torch
except ImportError:
pass
TABLE_TYPE_NEXT_VALUE_SEPARATOR = '__pyde... |
class _NpTable:
def __init__(self, np_array, format=None):
self.array = np_array
self.type = self.get_array_type()
self.indexes = None
self.format = format
def get_array_type(self):
if len(self.array.shape) > 1:
return TWO_DIM
return ONE_DIM
... | def get_bytes(arr):
# type: (np.ndarray) -> str
try:
from PIL import Image
try:
import tensorflow as tf
if isinstance(arr, tf.SparseTensor):
arr = tf.sparse.to_dense(tf.sparse.reorder(arr))
except ImportError:
pass
arr = arr.n... | python | 2025-01-20T18:29:11 |
JetBrains/intellij-community | ce99bf0c1dc1dbbeaab74e822c7592381bff9550 | platform/platform-tests/testSrc/com/intellij/wm/CloseProjectWindowHelperTest.kt | // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.wm
import com.intellij.openapi.project.Project
import com.intellij.openapi.wm.impl.CloseProjectWindowHelper
import com.intellij.testFramework.ProjectRule
import com.intellij.tes... |
}
helper.windowClosing(null)
assertThat(helper.wasQuitAppCalled).isTrue()
assertThat(helper.wasShowWelcomeFrameIfNoProjectOpenedCalled).isFalse()
}
}
open class TestCloseProjectWindowHelper : CloseProjectWindowHelper() {
var wasQuitAppCalled = false
private set
var wasShowWelcomeFrameIfNoP... | }
helper.windowClosing(null)
assertThat(helper.wasQuitAppCalled).isTrue()
assertThat(helper.wasShowWelcomeFrameIfNoProjectOpenedCalled).isFalse()
}
@Test
fun `on macOS closing a tab with tabbed project view`() {
val helper = object : TestCloseProjectWindowHelper() {
override val isMacSyste... | kotlin | 2025-01-30T13:23:06 |
JetBrains/intellij-community | c452f718f896e116f74c21548b4b5e8bdfce1faf | platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeBackgroundUtil.java | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.wm.impl;
import com.intellij.ide.ui.UISettings;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.app... |
createTemporaryBackgroundTransform(root, paintersHelper, disposable);
}
private static void createTemporaryBackgroundTransform(JComponent root, PainterHelper painterHelper, Disposable disposable) {
Disposer.register(disposable, JBSwingUtilities.addGlobalCGTransform((c, g) -> {
if (!UIUtil.isAncestor... | createTemporaryBackgroundTransform(root, paintersHelper, disposable);
}
/**
* Allows painting anything as a background for component and its children
*/
@ApiStatus.Experimental
public static void createTemporaryBackgroundTransform(JComponent root,
P... | java | 2025-01-30T17:17:41 |
JetBrains/intellij-community | 41669770938e96673118becf07b771fbed6aa633 | platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/IntellijIconClassGeneratorConfig.kt | // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.intellij.build.images
import org.jetbrains.jps.model.module.JpsModule
class IntellijIconClassGeneratorConfig : IconClasses() {
override val modules: List<JpsModule>
get(... |
// force generating "Groovy" inner class to preserve backward compatiblity
"intellij.groovy.psi" -> IntellijIconClassGeneratorModuleConfig(className = "JetgroovyIcons", iconDirectory = "icons")
"intellij.clouds.docker" -> IntellijIconClassGeneratorModuleConfig(className = "DockerIcons", packageName =... | "intellij.platform.ide.ui.inspector" -> IntellijIconClassGeneratorModuleConfig(
// inspection icons are loaded by com.intellij.internal.inspector.components.HierarchyTree.Icons
excludePackages = listOf("com.intellij.internal.inspector.icons"),
) | kotlin | 2025-01-30T19:40:00 |
JetBrains/intellij-community | bd0aa3d97876c56b0298e3fd9a43158f85a2580c | jps/jps-builders/testSrc/org/jetbrains/ether/AnnotationTest.java | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.ether;
import org.jetbrains.jps.builders.java.JavaBuilderUtil;
import java.util.Set;
public class AnnotationTest extends IncrementalTestCase {
private static final Set<Stri... |
}
public void testAddAnnotationTarget() {
doTest();
}
public void testAddAnnotationTargetTypeUse() {
doTest();
}
public void testAddTypeUseAnnotationTarget() {
doTest();
}
public void testAddRecordComponentAnnotationTarget() {
doTest();
}
public void testAddAnnotationTypeMemb... | }
@Override
protected boolean shouldRunTest() {
if (JavaBuilderUtil.isDepGraphEnabled()) {
return super.shouldRunTest();
}
return !GRAPH_ONLY_TESTS.contains(getTestName(true)); | java | 2025-01-31T14:15:29 |
JetBrains/intellij-community | 85764debe974acfee90cbd08fa694e7e893bb546 | platform/bootstrap/src/com/intellij/platform/bootstrap/ModuleBasedPluginXmlPathResolver.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.bootstrap
import com.intellij.ide.plugins.*
import com.intellij.platform.runtime.product.IncludedRuntimeModule
import com.intellij.platform.runtime.repository.RuntimeMo... |
}
override fun loadXIncludeReference(
readInto: RawPluginDescriptor,
readContext: ReadModuleContext,
dataLoader: DataLoader,
base: String?,
relativePath: String,
): Boolean {
return fallbackResolver.loadXIncludeReference(
readInto = readInto,
readContext = readContext,
... | }
override fun resolveCustomModuleClassesRoots(moduleName: String): List<Path> {
val moduleDescriptor = includedModules.find { it.moduleDescriptor.moduleId.stringId == moduleName }?.moduleDescriptor
return moduleDescriptor?.resourceRootPaths ?: emptyList() | kotlin | 2025-01-29T15:39:46 |
JetBrains/intellij-community | ea9aa44089b623dc2d6fc63bfde2ecc076711153 | platform/build-scripts/dev-server/src/DevMainImpl.kt | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:JvmName("DevMainImpl")
package org.jetbrains.intellij.build.devServer
import com.intellij.openapi.application.PathManager
import com.intellij.util.SystemProperties
import org.jetbrains.intelli... |
//TracerProviderManager.setOutput(Path.of(System.getProperty("user.home"), "trace.json"))
@Suppress("TestOnlyProblems")
val ideaProjectRoot = Path.of(PathManager.getHomePathFor(PathManager::class.java)!!)
System.setProperty("idea.dev.project.root", ideaProjectRoot.toString().replace(java.io.File.separator, "/"... | val info = buildDevImpl()
@Suppress("SpellCheckingInspection")
val exceptions = setOf("jna.boot.library.path", "pty4j.preferred.native.folder", "jna.nosys", "jna.noclasspath", "jb.vmOptionsFile")
val systemProperties = System.getProperties()
for ((name, value) in info.systemProperties) {
if (exceptions.con... | kotlin | 2025-01-29T17:08:26 |
JetBrains/intellij-community | 0458e409eebf5dbbfc8aa24726503302d8414018 | plugins/markdown/core/src/org/intellij/plugins/markdown/ui/preview/MarkdownHtmlPanel.java | // Copyright 2000-2025 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.intellij.plugins.markdown.ui.preview;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.util.Ed... |
/**
* @return null if current preview implementation doesn't support any message passing.
*/
@ApiStatus.Experimental
default @Nullable BrowserPipe getBrowserPipe() {
return null;
}
@ApiStatus.Experimental
default @Nullable Project getProject() {
return null;
}
@ApiStatus.Experimental
... | default void setHtml(@NotNull String html, int initialScrollOffset, int initialScrollLineNumber, @Nullable VirtualFile document) {
setHtml(html, initialScrollOffset, document);
} | java | 2025-01-31T12:36:45 |
JetBrains/intellij-community | fcc451bd7524a25549d2829fb00a9fb5e8398084 | plugins/kotlin/refactorings/kotlin.refactorings.tests.k2/test/org/jetbrains/kotlin/idea/k2/refactoring/bindToElement/AbstractK2BindToTest.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.k2.refactoring.bindToElement
import com.intellij.psi.PsiFile
import com.intellij.psi.util.parentOfType
import org.jetbrains.kotlin.analysis.api.permissions.KaAllowA... |
override fun getProjectDescriptor() = ProjectDescriptorWithStdlibSources.getInstanceWithStdlibSources()
@OptIn(KaAllowAnalysisOnEdt::class)
override fun doMultiFileTest(files: List<PsiFile>, globalDirectives: Directives) = allowAnalysisOnEdt {
val mainFile = files.first()
myFixture.config... | override fun doTest(testDataPath: String) {
IgnoreTests.runTestIfNotDisabledByFileDirective(
dataFilePath(),
IgnoreTests.DIRECTIVES.of(pluginMode),
test = { super.doTest(testDataPath) }
)
} | kotlin | 2025-01-31T13:13:51 |
JetBrains/intellij-community | fcc451bd7524a25549d2829fb00a9fb5e8398084 | plugins/kotlin/refactorings/kotlin.refactorings.tests.k2/test/org/jetbrains/kotlin/idea/k2/refactoring/bindToElement/K2BindToFqnTestGenerated.java | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.k2.refactoring.bindToElement;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode;
import org.jetbrains.k... |
@TestMetadata("../../idea/tests/testData/refactoring/bindToFqn/propertyTypeReference")
public static class PropertyTypeReference extends AbstractK2BindToFqnTest {
@java.lang.Override
@org.jetbrains.annotations.NotNull
public final KotlinPluginMode getPluginMode() {
return Ko... | @TestMetadata("../../idea/tests/testData/refactoring/bindToFqn/packageVsDeclarationCollision")
public static class PackageVsDeclarationCollision extends AbstractK2BindToFqnTest {
@java.lang.Override
@org.jetbrains.annotations.NotNull
public final KotlinPluginMode getPluginMode() {
... | java | 2025-01-31T13:13:51 |
JetBrains/intellij-community | 5849b9860ba5cd72e5f3172fd07c6ad07d33728a | platform/external-system-api/src/com/intellij/openapi/externalSystem/settings/ProjectBuildClasspathManager.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.externalSystem.settings
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.components.Service
import com.intellij.openapi.externalSystem.... |
@ApiStatus.Internal
@Service(Service.Level.PROJECT)
class ProjectBuildClasspathManager(val project: Project, val coroutineScope: CoroutineScope) {
@RequiresBackgroundThread
fun setProjectBuildClasspathSync(value: Map<String, ExternalProjectBuildClasspathPojo>) {
runBlockingCancellable {
setProjectBuildC... | /**
* Manages the build classpath for external projects within a specific project context.
*
* This service provides functionality to read and update the build classpath configurations
* for external projects associated with the current IntelliJ project.
* To remove outdated information (e.g., a project that is no... | kotlin | 2024-12-24T13:17:48 |
JetBrains/intellij-community | 0ae79596ca62761e79f45c888364e91ff074ed89 | platform/util/src/com/intellij/util/coroutineScope.kt | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.util
import com.intellij.openapi.Disposable
import com.intellij.openapi.util.Disposer
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.corou... |
}
/**
* Creates a disposable that will be disposed on [this] scope cancellation.
*
* Manual disposal of a created Disposable is also possible and doesn't touch [this] scope.
*/
fun CoroutineScope.asDisposable(): Disposable {
return Disposer.newDisposable("Disposable from scope: $this").also { it.attachAsChildTo... | }
/**
* This function is deprecated to emphasize that the disposable does not become a child of the scope.
* - Its disposal happens out of scope, after the scope is completed. The scope does not wait for the disposal.
* - The disposal failure does not cancel the scope.
*/
@Deprecated("Use `disposeOnCompletion` ins... | kotlin | 2025-01-31T10:41:38 |
JetBrains/intellij-community | 411f92d80e7a6ecc3a6e21e5923943e73adefbce | notebooks/visualization/src/com/intellij/notebooks/visualization/ui/EditorCellInput.kt | package com.intellij.notebooks.visualization.ui
import com.intellij.notebooks.ui.visualization.NotebookEditorAppearanceUtils.isOrdinaryNotebookEditor
import com.intellij.notebooks.ui.visualization.NotebookUtil.notebookAppearance
import com.intellij.notebooks.visualization.NotebookCellInlayController
import com.intelli... |
}
override fun dispose() {
super.dispose()
Disposer.dispose(folding)
cellActionsToolbar?.let { Disposer.dispose(it) }
Disposer.dispose(draggableBar)
}
fun update() {
updateInput()
}
fun getBlockElementsInRange(): List<Inlay<*>> {
val linesRange = interval.lines
val startOffse... | }
private fun fold() = editor.updateManager.update { ctx ->
folded = true
(component as? InputComponent)?.updateFolding(ctx, true)
}
private fun unfold() = editor.updateManager.update { ctx ->
folded = false
(component as? InputComponent)?.updateFolding(ctx, false) | kotlin | 2025-01-29T14:29:40 |
JetBrains/intellij-community | 411f92d80e7a6ecc3a6e21e5923943e73adefbce | notebooks/visualization/src/com/intellij/notebooks/visualization/ui/cellsDnD/EditorCellDraggableBar.kt | package com.intellij.notebooks.visualization.ui.cellsDnD
import com.intellij.icons.AllIcons
import com.intellij.notebooks.ui.visualization.NotebookEditorAppearanceUtils.isOrdinaryNotebookEditor
import com.intellij.notebooks.ui.visualization.NotebookUtil.notebookAppearance
import com.intellij.notebooks.visualization.No... |
}
private fun handleDrag(currentLocationOnScreen: Point) {
val editorLocationOnScreen = editor.contentComponent.locationOnScreen
val x = currentLocationOnScreen.x - editorLocationOnScreen.x
val y = currentLocationOnScreen.y - editorLocationOnScreen.y
val cellUnderCursor = getCellUnder... | }
private fun retrieveTargetCell(e: MouseEvent): CellDropTarget {
val dropLocation = e.locationOnScreen
val editorLocationOnScreen = editor.contentComponent.locationOnScreen
val x = dropLocation.x - editorLocationOnScreen.x
val y = dropLocation.y - editorLocationOnScreen.y
val editorP... | kotlin | 2025-01-29T14:29:40 |
JetBrains/intellij-community | 9543e2469afb974fe931cfafb31906a4aca33dd0 | plugins/kotlin/base/psi/src/org/jetbrains/kotlin/idea/base/psi/PsiLinesUtils.kt | // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.base.psi
import com.intellij.openapi.editor.Document
import com.intellij.openapi.util.TextRange
import com.intellij.openapi.util.text.StringUtil
import com.intelli... |
fun PsiElement.getLineNumber(start: Boolean = true): Int {
val document = containingFile.viewProvider.document ?: PsiDocumentManager.getInstance(project).getDocument(containingFile)
val index = if (start) this.startOffset else this.endOffset
if (index > (document?.textLength ?: 0)) return 0
return doc... | fun PsiFile.getLineNumber(offset: Int): Int? {
val document = viewProvider.document ?: PsiDocumentManager.getInstance(project).getDocument(this) ?: return null
return runCatching { document.getLineNumber(offset) }.getOrNull()
} | kotlin | 2025-01-28T12:54:48 |
JetBrains/intellij-community | 9543e2469afb974fe931cfafb31906a4aca33dd0 | plugins/kotlin/jvm/src/org/jetbrains/kotlin/idea/scratch/ScratchExecutor.kt | // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
/*
* Copyrig()ht 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in complia... |
abstract class SequentialScratchExecutor(file: ScratchFile) : ScratchExecutor(file) {
abstract fun executeStatement(expression: ScratchExpression)
protected abstract fun startExecution()
protected abstract fun stopExecution(callback: (() -> Unit)? = null)
protected abstract fun needProcessToStart():... | class K2ScratchExecutor(val scratchFile: ScratchFile, val project: Project, val scope: CoroutineScope) : ScratchExecutor(scratchFile) {
override fun execute() {
handler.onStart(file)
val scriptFile = scratchFile.file
scope.launch {
val document = readAction { scriptFile.findDoc... | kotlin | 2025-01-28T12:54:48 |
JetBrains/intellij-community | 9543e2469afb974fe931cfafb31906a4aca33dd0 | plugins/kotlin/jvm/src/org/jetbrains/kotlin/idea/scratch/ui/ScratchTopPanel.kt | // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.scratch.ui
import com.intellij.openapi.actionSystem.*
import com.intellij.openapi.application.ApplicationManager
import com.... |
class ScratchTopPanel(val scratchFile: ScratchFile) {
private val moduleChooserAction: ModulesComboBoxAction = ModulesComboBoxAction(scratchFile)
val actionsToolbar: ActionToolbar
init {
setupTopPanelUpdateHandlers()
val toolbarGroup = DefaultActionGroup().apply {
add(RunScra... | class ScratchTopPanelK2(val scratchFile: ScratchFile) {
val actionsToolbar: ActionToolbar
init {
setupTopPanelUpdateHandlers()
val toolbarGroup = DefaultActionGroup().apply {
add(RunScratchAction())
addSeparator()
add(ClearScratchAction())
addSep... | kotlin | 2025-01-28T12:54:48 |
JetBrains/intellij-community | ee557d2f19ce4692be9b28209d0c571c776b5c00 | platform/platform-api/src/com/intellij/ui/dsl/gridLayout/UnscaledGaps.kt | // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ui.dsl.gridLayout
import com.intellij.ui.dsl.checkNonNegative
import com.intellij.util.ui.JBEmptyBorder
import com.intellij.util.ui.JBInsets
import org.jetbrains.annotations.Api... |
}
private class UnscaledGapsImpl(private val _top: Int,
private val _left: Int,
private val _bottom: Int,
private val _right: Int) : UnscaledGaps {
override val top: Int
get() = _top
override val left: Int
get() ... | }
private object EmptyGaps : UnscaledGaps {
override val top: Int = 0
override val left: Int = 0
override val bottom: Int = 0
override val right: Int = 0
override fun copy(top: Int, left: Int, bottom: Int, right: Int): UnscaledGaps {
return UnscaledGapsImpl(top, left, bottom, right)
}
override fun ... | kotlin | 2025-01-29T14:31:14 |
JetBrains/intellij-community | ee557d2f19ce4692be9b28209d0c571c776b5c00 | platform/platform-api/src/com/intellij/ui/dsl/gridLayout/UnscaledGapsX.kt | // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ui.dsl.gridLayout
import com.intellij.ui.dsl.checkNonNegative
/**
* Defines left and right gaps. Values must be provided unscaled
*/
interface UnscaledGapsX {
companion obj... |
}
private class UnscaledGapsXImpl(private val _left: Int, private val _right: Int) : UnscaledGapsX {
override val left: Int
get() = _left
override val right: Int
get() = _right
init {
checkNonNegative("left", left)
checkNonNegative("right", right)
}
override fun toString(): String {
r... | }
private object EmptyGapsX : UnscaledGapsX {
override val left: Int = 0
override val right: Int = 0
override fun toString(): String {
return "left = 0, right = 0"
} | kotlin | 2025-01-29T14:31:14 |
JetBrains/intellij-community | ee557d2f19ce4692be9b28209d0c571c776b5c00 | platform/platform-api/src/com/intellij/ui/dsl/gridLayout/UnscaledGapsY.kt | // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ui.dsl.gridLayout
import com.intellij.ui.dsl.checkNonNegative
import org.jetbrains.annotations.ApiStatus
/**
* Defines top and bottom gaps. Values must be provided unscaled
*... |
}
private class UnscaledGapsYImpl(private val _top: Int, private val _bottom: Int) : UnscaledGapsY {
override val top: Int
get() = _top
override val bottom: Int
get() = _bottom
init {
checkNonNegative("top", top)
checkNonNegative("bottom", bottom)
}
override fun copy(top: Int, bottom: Int... | }
private object EmptyGapsY : UnscaledGapsY {
override val top: Int = 0
override val bottom: Int = 0
override fun copy(top: Int, bottom: Int): UnscaledGapsY {
return UnscaledGapsYImpl(top, bottom)
}
override fun toString(): String {
return "top = 0, bottom = 0"
} | kotlin | 2025-01-29T14:31:14 |
JetBrains/intellij-community | 87816bdb8613d058230d60089c39193abb3af5dd | platform/platform-impl/src/com/intellij/openapi/editor/impl/view/ComplexTextFragment.java | // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.editor.impl.view;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.EditorSettings;
import com.intellij.openapi.editor.impl.FontInfo;
imp... |
int numChars = end - start;
int numGlyphs = myGlyphVector.getNumGlyphs();
float totalWidth = (float)myGlyphVector.getGlyphPosition(numGlyphs).getX();
myCharPositions[numChars - 1] = totalWidth;
int lastCharIndex = -1;
float lastX = isRtl ? totalWidth : 0;
float prevX = lastX;
// Here we... | var gridWidth = settings != null ? settings.getCharacterGridWidth() : null;
if (gridWidth != null) {
// This thing assumes that one glyph = one character.
// This seems to work "well enough" for the terminal
// (the only place where it's used at the moment of writing),
// but may need to be ... | java | 2025-01-30T15:37:19 |
JetBrains/intellij-community | 233a05d840350968601773e01f88fbf8804f7b64 | plugins/maven/src/main/java/org/jetbrains/idea/maven/execution/ExecRemoteConnectionCreator.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.maven.execution
import com.intellij.execution.configurations.JavaParameters
import com.intellij.execution.configurations.ParametersList
import com.intellij.execution.confi... |
override fun createRemoteConnection(javaParameters: JavaParameters, runConfiguration: MavenRunConfiguration): RemoteConnection? {
val programParametersList = javaParameters.programParametersList
if (programParametersList.list.find { it == "exec:exec" || EXEC_MAVEN_PLUGIN_PATTERN.matcher(it).matches() } == n... | override fun createRemoteConnection(runConfiguration: MavenRunConfiguration): MavenRemoteConnection? {
val parameters = JavaParameters()
val connection = createConnection(runConfiguration.project, parameters)
val parametersOfConnection = parameters.vmParametersList
return MavenRemoteConnection(connecti... | kotlin | 2025-01-29T20:07:19 |
JetBrains/intellij-community | c16bd2b684f1de00f46b04d19992c33252c6cda8 | java/java-tests/testSrc/com/intellij/java/codeInsight/intention/AddOnDemandStaticImportToAutoImportActionTest.java | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.codeInsight.intention;
import com.intellij.codeInsight.JavaProjectCodeInsightSettings;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.java.J... |
""");
assertTrue(tryToAddToAutoImport("java.util.Objects"));
assertTrue(tableContains("java.util.Objects"));
});
}
public void testAlreadyAdded() {
doTest(() -> {
JavaProjectCodeInsightSettings codeInsightSettings = JavaProjectCodeInsightSettings.getSettings(getProject());
... | public class Favorite {
public static void a() {
require<caret>NonNull("a");
}
}
""");
assertTrue(tryToAddToAutoImport("java.util.Objects"));
assertTrue(tableContains("java.util.Objects"));
});
}
public void testAddFromCall() {
doTest(() -... | java | 2025-01-30T11:28:33 |
JetBrains/intellij-community | ca1741caaa05f4e58e9cd475e902fe7719ae760b | plugins/kotlin/base/fir/scripting/src/org/jetbrains/kotlin/base/fir/scripting/projectStructure/K2ScriptingKaModuleFactory.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.base.fir.scripting.projectStructure
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.io.FileUtilRt
import com.intellij.platform.workspace.jps... |
}
override fun createSpecialLibraryModule(libraryEntity: LibraryEntity, project: Project): KaLibraryModule? {
if (libraryEntity.entitySource is KotlinScriptEntitySource) {
return KaScriptDependencyLibraryModuleImpl(libraryEntity.symbolicId, project)
}
return null
}
} | }
/**
* From https://github.com/JetBrains/kotlin/blob/b4b1c7cd698c1e8276a0bed504f22b93582d4f2e/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinParser.java#L46
*
* to avoid accessing stubs inside
*/
private fun KtFile.kotlinParserWillCreateKtScriptHere(): Boolean {
val extension ... | kotlin | 2025-01-30T10:34:33 |
JetBrains/intellij-community | 5dada0035c4bbb9e68b2536da205a60938223ca2 | plugins/terminal/src/org/jetbrains/plugins/terminal/action/reworked/EscapeHandlers.kt | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.terminal.action.reworked
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.PlatformDataKeys
import com.intellij.openapi.op... |
}
}
internal class SelectEditor : TerminalEscapeHandler {
override val order: Int
get() = 500
override fun isEnabled(e: AnActionEvent): Boolean =
e.project != null &&
e.editor?.isOutputModelEditor == true && // only for the regular buffer, as apps with the alternate buffer may need Esc themselves
... | }
}
internal class CloseSearch : TerminalEscapeHandler {
override val order: Int
get() = 300
override fun isEnabled(e: AnActionEvent): Boolean = e.dataContext.terminalSearchController?.hasActiveSession() == true
override fun execute(e: AnActionEvent) {
e.dataContext.terminalSearchController?.finishSear... | kotlin | 2025-01-29T12:11:41 |
JetBrains/intellij-community | f3262817629e278f76e5c1c218e455699d163acf | plugins/terminal/tests/org/jetbrains/plugins/terminal/reworked/TerminalOutputModelTest.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.terminal.reworked
import com.intellij.openapi.application.EDT
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.jediterm.terminal.TextStyle
imp... |
val expectedHighlightingsSnapshot = TerminalOutputHighlightingsSnapshot(model.document, expectedHighlightings)
assertEquals(expectedText, model.document.text)
assertEquals(expectedHighlightingsSnapshot, model.getHighlightings())
}
private fun styleRange(start: Int, end: Int): StyleRange {
return ... | val expectedHighlightingsSnapshot = TerminalOutputHighlightingsSnapshot(model.document, expectedHighlightings)
assertEquals(expectedText, model.document.text)
assertEquals(expectedHighlightingsSnapshot, model.getHighlightings())
}
@Test
fun `check that spaces are added if cursor is out of line bounds (l... | kotlin | 2025-01-30T07:24:40 |
JetBrains/intellij-community | 5a291a41cb93348e3d01537325014e4e5554601f | platform/searchEverywhere/frontend/src/ui/SePopupContentPane.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.searchEverywhere.frontend.ui
import com.intellij.ide.IdeBundle
import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.*
import com.intellij.ope... |
}
private fun createListPane(resultList: JBList<*>): JScrollPane {
val resultsScroll: JScrollPane = object : JBScrollPane(resultList) {
override fun updateUI() {
val isBorderNull = border == null
super.updateUI()
if (isBorderNull) border = null
}
}
resultsScroll.bor... | val verticalScrollBar = resultsScrollPane.verticalScrollBar
verticalScrollBar.addAdjustmentListener { adjustmentEvent ->
val yetToScrollHeight = verticalScrollBar.maximum - verticalScrollBar.model.extent - adjustmentEvent.value
if (verticalScrollBar.model.extent > 0 && yetToScrollHeight < 50) {
... | kotlin | 2025-01-20T16:40:43 |
JetBrains/intellij-community | a6b50f7e8582023118b65888e5624f81c4ac19e9 | platform/lang-impl/src/com/intellij/ide/util/gotoByName/SeActionsTab.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.util.gotoByName
import com.intellij.lang.LangBundle
import com.intellij.openapi.options.ObservableOptionEditor
import com.intellij.platform.searchEverywhere.SeItemData
impor... |
}
@ApiStatus.Internal
class SeActionsFilterEditor : ObservableOptionEditor<SeFilterData> {
private var current: SeActionsFilterData? = null
private val _resultFlow: MutableStateFlow<SeFilterData?> = MutableStateFlow(current?.toFilterData())
override val resultFlow: StateFlow<SeFilterData?> = _resultFlow.asStat... | override suspend fun itemSelected(item: SeItemData, modifiers: Int, searchText: String): Boolean {
return helper.itemSelected(item, modifiers, searchText)
} | kotlin | 2025-01-17T17:57:08 |
JetBrains/intellij-community | a6b50f7e8582023118b65888e5624f81c4ac19e9 | platform/searchEverywhere/frontend/src/mocks/SeTabMock.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.searchEverywhere.frontend.mocks
import com.intellij.openapi.options.ObservableOptionEditor
import com.intellij.openapi.project.Project
import com.intellij.platform.sear... |
companion object {
suspend fun create(project: Project,
sessionRef: DurableRef<SeSessionEntity>,
name: String,
providerIds: List<SeProviderId>,
forceRemote: Boolean = false): SeTabMock {
val helper = SeTabHelper.cr... | override suspend fun itemSelected(item: SeItemData, modifiers: Int, searchText: String): Boolean {
println("Item selected: ${item.presentation.text}")
return true
} | kotlin | 2025-01-17T17:57:08 |
JetBrains/intellij-community | a6b50f7e8582023118b65888e5624f81c4ac19e9 | platform/searchEverywhere/frontend/src/mocks/files/SeFilesTab.kt | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.searchEverywhere.frontend.mocks.files
import com.intellij.openapi.options.ObservableOptionEditor
import com.intellij.platform.searchEverywhere.SeItemData
import com.int... |
}
@Internal
class SeFilesFilterEditor : ObservableOptionEditor<SeFilterData> {
private var current: SeFilesFilterData? = null
private val _resultFlow: MutableStateFlow<SeFilterData?> = MutableStateFlow(current?.toFilterData())
override val resultFlow: StateFlow<SeFilterData?> = _resultFlow.asStateFlow()
ove... | override suspend fun itemSelected(item: SeItemData, modifiers: Int, searchText: String): Boolean {
return helper.itemSelected(item, modifiers, searchText)
} | kotlin | 2025-01-17T17:57:08 |
JetBrains/intellij-community | a6b50f7e8582023118b65888e5624f81c4ac19e9 | platform/searchEverywhere/shared/src/mocks/SeItemsProviderMock.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.searchEverywhere.mocks
import com.intellij.platform.searchEverywhere.SeItemPresentation
import com.intellij.platform.searchEverywhere.SeParams
import com.intellij.platf... |
}
@ApiStatus.Internal
class SeItemMock(val text: String) : SeItem {
override fun weight(): Int = 0
override fun presentation(): SeItemPresentation = SeTextItemPresentation(text = text)
}
| override suspend fun itemSelected(item: SeItem, modifiers: Int, searchText: String): Boolean {
println("item selected: ${item.presentation().text} - ${item}")
return true
} | kotlin | 2025-01-17T17:57:08 |
JetBrains/intellij-community | 9e9386b5c6884e1c872386c5ed44d0b4cb2e5a45 | platform/searchEverywhere/backend/src/impl/SeItemDataBackendProvider.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.searchEverywhere.backend.impl
import com.intellij.platform.searchEverywhere.*
|
import fleet.kernel.DurableRef
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.mapNotNull
import org.jetbrains.annotations.ApiStatus.Internal
@Internal
class SeItemDataBackendProvider(override val id: SeProviderId,
private val provider: SeItemsProvider
): SeItemDataP... | import com.intellij.platform.searchEverywhere.api.SeItemDataProvider
import com.intellij.platform.searchEverywhere.api.SeItemsProvider | kotlin | 2025-01-09T10:52:01 |
JetBrains/intellij-community | 9e9386b5c6884e1c872386c5ed44d0b4cb2e5a45 | platform/searchEverywhere/frontend/src/SeItemDataLocalProvider.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.searchEverywhere.frontend
import com.intellij.platform.searchEverywhere.*
|
import fleet.kernel.DurableRef
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.mapNotNull
import org.jetbrains.annotations.ApiStatus.Internal
@Internal
class SeItemDataLocalProvider(private val itemsProvider: SeItemsProvider): SeItemDataProvider {
override val id: SeProviderId
get() = SeProvi... | import com.intellij.platform.searchEverywhere.api.SeItemDataProvider
import com.intellij.platform.searchEverywhere.api.SeItemsProvider | kotlin | 2025-01-09T10:52:01 |
JetBrains/intellij-community | 32d578cd725780f788872725b4f5246d8f622859 | platform/searchEverywhere/shared/src/SearchEverywhereItemPresentation.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.searchEverywhere
import com.intellij.platform.backend.presentation.TargetPresentation
import kotlinx.serialization.Serializable
import org.jetbrains.annotations.ApiStat... |
data class ActionItemPresentation(
val icon: Icon? = null,
override val text: String,
val location: String? = null,
val switcherState: Boolean? = null,
val isEnabled: Boolean = true,
val shortcut: String? = null,
): SearchEverywhereItemPresentation
@ApiStatus.Internal
@Serializable
class TargetItemPresent... | @Serializable
class SearchEverywhereTextItemPresentation(override val text: String): SearchEverywhereItemPresentation
@ApiStatus.Internal
@Serializable | kotlin | 2024-12-16T18:07:12 |
JetBrains/intellij-community | f496d2f555a3ac8f66cbb6cdeaadd12c82a3cc7f | platform/searchEverywhere/shared/src/SearchEverywhereTabProvider.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.searchEverywhere
import com.intellij.openapi.extensions.ExtensionPointName
|
import org.jetbrains.annotations.ApiStatus
@ApiStatus.Experimental
interface SearchEverywhereTabProvider {
fun getTab(project: Project, sessionId: EID): SearchEverywhereTab
companion object {
@ApiStatus.Internal
val EP_NAME: ExtensionPointName<SearchEverywhereTabProvider> = ExtensionPointName("com.intell... | import com.intellij.openapi.project.Project
import com.jetbrains.rhizomedb.EID | kotlin | 2024-12-11T16:22:33 |
JetBrains/intellij-community | e32b6f4e000f821737cc6bf8c344ce9a1356bb88 | plugins/kotlin/fir/tests/test/org/jetbrains/kotlin/idea/fir/completion/K2JvmBasicCompletionFullJdkTestGenerated.java | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.fir.completion;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode;
import org.jetbrains.kotlin.idea.bas... |
@TestMetadata("ParameterName3.kt")
public void testParameterName3() throws Exception {
runTest("../../completion/testData/basic/fullJdk/lambdaSignature/ParameterName3.kt");
}
@TestMetadata("ParameterName4.kt")
public void testParameterName4() throws Exception {
... | @TestMetadata("ParameterName21.kt")
public void testParameterName21() throws Exception {
runTest("../../completion/testData/basic/fullJdk/lambdaSignature/ParameterName21.kt");
}
@TestMetadata("ParameterName22.kt")
public void testParameterName22() throws Exception {
... | java | 2025-01-29T18:36:32 |
JetBrains/intellij-community | 9e6332372d013cb1ae9351983bc06a456913ec70 | platform/util/ui/src/com/intellij/ui/ClientProperty.java | // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ui;
import com.intellij.openapi.util.Key;
import com.intellij.util.ReflectionUtil;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NonNls;
import org... |
@Contract("null -> null")
private static @Nullable JComponent getPropertiesHolder(@Nullable Component component) {
if (component instanceof JComponent) return (JComponent)component;
if (component instanceof Window && component instanceof RootPaneContainer container) {
// store window properties in i... | private static final Key<Map<Key<?>, ContainerListener>> RECURSIVE_LISTENERS = Key.create("ClientProperty.recursiveListeners");
/**
* Sets the value for the client property of the component and its children.
* If hierarchy is changed, it sets the property for new components
* @param component a Swing compone... | java | 2024-11-12T16:48:00 |
JetBrains/intellij-community | 98bebf39889e887caf8f6bb128d678a59362d5b9 | platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeRegistry.java | // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.fileTypes;
import com.intellij.ide.plugins.DynamicPluginListener;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.lang.Language;
import com.int... |
}
@ApiStatus.Internal
public static boolean isInstanceSupplierSet() {
return instance != null;
}
public abstract boolean isFileIgnored(@NotNull VirtualFile file);
/**
* Checks if the given file has the given file type.
*/
public boolean isFileOfType(@NotNull VirtualFile file, @NotNull FileTy... | }
public FileTypeRegistry() {
Application application = ApplicationManager.getApplication();
if (application != null) {
application.getMessageBus().simpleConnect().subscribe(DynamicPluginListener.TOPIC, new DynamicPluginListener() {
@Override
public void pluginUnloaded(@NotNull IdeaPlug... | java | 2025-01-23T16:54:21 |
JetBrains/intellij-community | 4f69e19050bad14dd97ca5189629ec4b38e7e2a8 | platform/analysis-api/src/com/intellij/lang/annotation/AnnotationBuilder.java | // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.annotation;
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
import com.intellij.codeInsight.daemon.QuickFixActionRegistrar;
import com.intellij.codeInsight.inte... |
interface FixBuilder {
/**
* Specify the range for this quick fix. If not specified, the annotation range is used.
* This is an intermediate method in the registering new quick fix pipeline.
* @param range the range for this fix
* @return this builder for chaining convenience
*/
@Co... | /**
* Specifies the function ({@code quickFixComputer}) which could produce
* quick fixes for this Annotation by calling {@link QuickFixActionRegistrar#register} methods, once or several times.
* Use this method for quick fixes that are too expensive to be registered via regular {@link #newFix} method.
* Th... | java | 2025-01-23T11:10:33 |
JetBrains/intellij-community | 5b550504fabe7ea31bfa4bfbcaa09394eb2134c5 | grid/impl/src/run/ui/CellViewer.kt | package com.intellij.database.run.ui
import com.intellij.database.datagrid.DataGrid
import com.intellij.database.datagrid.GridColumn
import com.intellij.database.datagrid.GridRow
import com.intellij.database.datagrid.ModelIndex
import com.intellij.openapi.Disposable
import com.intellij.openapi.extensions.ExtensionPoin... |
}
sealed interface UpdateEvent {
data object ContentChanged : UpdateEvent
data object SelectionChanged : UpdateEvent
data object SettingsChanged : UpdateEvent
data class ValueChanged(val value: Any?) : UpdateEvent
}
enum class Suitability {
NONE,
MIN_1,
MIN_2,
MAX
} | companion object {
private val EP_NAME = ExtensionPointName<CellViewerFactory>("com.intellij.database.datagrid.cellViewerFactory")
fun getExternalFactories(): List<CellViewerFactory> = EP_NAME.extensionList
} | kotlin | 2025-01-29T11:11:33 |
JetBrains/intellij-community | 785b86942c98c5492e4bc3cbf0dd6b8213ab4e49 | platform/xdebugger-impl/frontend/src/com/intellij/platform/debugger/impl/frontend/actions/FrontendMarkObjectAction.kt | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.debugger.impl.frontend.actions
import com.intellij.idea.ActionsBundle
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSyst... |
val markers = getMarkers(event) ?: run {
event.presentation.isEnabledAndVisible = false
return
}
val value = XDebuggerTreeActionBase.getSelectedValue(event.dataContext) ?: run {
event.presentation.isEnabledAndVisible = false
return
}
val canMark = markers.canMarkValue(valu... | event.presentation.text = ActionsBundle.message("action.Debugger.MarkObject.text")
event.presentation.description = ActionsBundle.message("action.Debugger.MarkObject.description") | kotlin | 2025-01-28T17:34:59 |
JetBrains/intellij-community | 3ada1023503ab4070994e4a154b28885b83e0840 | java/java-tests/testSrc/com/intellij/java/psi/resolve/StubPsiConsistencyTest.kt | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.psi.resolve
import com.intellij.find.ngrams.TrigramIndex
import com.intellij.openapi.application.readAction
import com.intellij.openapi.application.writeAction
import com.i... |
}
}
//@Test IJPL-176118
fun testDiskUpdateAfterMemUpdate() = timeoutRunBlocking(timeout = 1.minutes) {
val project = projectFixture.get()
val filesDir = psiFile1Fixture.get().virtualFile.toNioPathOrNull()!!.parent
val testFilesDir = filesDir.resolve("testfiles")
testFilesDir.createDirectori... | }
}
//@Test IJPL-176174
fun testStubInconsistencyWhenFileWithUncommittedPsiSharedBetweenProjects() = timeoutRunBlocking(timeout = 1.minutes) {
val project1 = projectFixture.get()
val project2 = projectFixture2.get()
val virtualFile1 = psiFile1Fixture.get().virtualFile
writeAction { // add sourc... | kotlin | 2025-01-28T23:19:00 |
JetBrains/intellij-community | e4f87aca3f5e09edf592888a976a305bf83f32de | java/java-tests/testSrc/com/intellij/java/psi/resolve/StubPsiConsistencyTest.kt | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.psi.resolve
import com.intellij.find.ngrams.TrigramIndex
import com.intellij.openapi.application.readAction
import com.intellij.openapi.application.writeAction
import com.i... |
}
}
private fun assertFileContentIsNotIndexed(project: Project, virtualFile1: VirtualFile) {
val fbi = (FileBasedIndex.getInstance() as FileBasedIndexImpl)
val projectDirtyFiles = fbi.changedFilesCollector.dirtyFiles.getProjectDirtyFiles(project)!!
assertTrue(projectDirtyFiles.containsFile((virtua... | }
}
//@Test IJPL-176118
fun testDiskUpdateAfterMemUpdate() = timeoutRunBlocking(timeout = 1.minutes) {
val project = projectFixture.get()
val filesDir = psiFile1Fixture.get().virtualFile.toNioPathOrNull()!!.parent
val testFilesDir = filesDir.resolve("testfiles")
testFilesDir.createDirectories()
... | kotlin | 2025-01-28T14:41:33 |
JetBrains/intellij-community | be747e6461ee52e5754b98aa29d84b99c851bc9a | java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/TypeChecker.java | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.codeserver.highlighting;
import com.intellij.java.codeserver.highlighting.errors.JavaErrorKinds;
import com.intellij.java.codeserver.highlighting.errors.JavaIncompatibleTyp... |
private static boolean allChildrenAreNullLiterals(PsiExpression expression) {
expression = PsiUtil.skipParenthesizedExprDown(expression);
if (expression == null) return false;
if (expression instanceof PsiLiteralExpression literal && PsiTypes.nullType().equals(literal.getType())) return true;
if (ex... | void checkVariableInitializerType(@NotNull PsiVariable variable) {
PsiExpression initializer = variable.getInitializer();
// array initializer checked in checkArrayInitializerApplicable
if (initializer == null || initializer instanceof PsiArrayInitializerExpression) return;
PsiType lType = variable.getT... | java | 2025-01-28T14:14:44 |
JetBrains/intellij-community | e71c86bdb672676d42c8994e3ac2bf1e04b2b038 | java/java-impl/src/com/intellij/externalSystem/JavaProjectDataService.kt | // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.externalSystem
import com.intellij.compiler.CompilerConfiguration
import com.intellij.openapi.externalSystem.model.DataNode
import com.intellij.openapi.externalSystem.model.Key
... |
}
}
internal object JavaProjectDataServiceUtil {
internal fun adjustLevelAndNotify(project: Project, level: LanguageLevel): LanguageLevel {
if (!AcceptedLanguageLevelsSettings.isLanguageLevelAccepted(level)) {
val highestAcceptedLevel = AcceptedLanguageLevelsSettings.getHighestAcceptedLevel()
if ... | }
private fun importCompilerArguments(project: Project, javaProjectData: JavaProjectData) {
val compilerConfiguration = CompilerConfiguration.getInstance(project)
val compilerArguments = javaProjectData.compilerArguments
compilerConfiguration.additionalOptions = compilerArguments | kotlin | 2025-01-28T14:20:55 |
JetBrains/intellij-community | e71c86bdb672676d42c8994e3ac2bf1e04b2b038 | plugins/gradle/java/testSources/importing/GradleJavaImportingTestCase.kt | // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.gradle.importing
import com.intellij.compiler.CompilerConfiguration
import com.intellij.java.library.LibraryWithMavenCoordinatesProperties
import co... |
fun assertModuleCompilerArgumentsVersion(moduleName: String, vararg expectedCompilerArguments: String) {
val module = getModule(moduleName)
val actualCompilerArguments = CompilerConfiguration.getInstance(myProject).getAdditionalOptions(module)
CollectionAssertions.assertEqualsOrdered(expectedCompilerArg... | fun assertProjectCompilerArgumentsVersion(vararg expectedCompilerArguments: String) {
val actualCompilerArguments = CompilerConfiguration.getInstance(myProject).getAdditionalOptions()
CollectionAssertions.assertEqualsOrdered(expectedCompilerArguments.asList(), actualCompilerArguments)
} | kotlin | 2025-01-28T14:20:55 |
JetBrains/intellij-community | f1a3121ea4c92db85772bbaa9b40e087fc2f9f76 | plugins/gradle/java/testSources/importing/GradleMiscImportingTest.java | // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.gradle.importing;
import com.intellij.ide.highlighter.ModuleFileType;
import com.intellij.java.workspace.entities.JavaModuleSettingsKt;
import com.intellij.openapi.appl... |
public void testJdkName() throws Exception {
Sdk myJdk = IdeaTestUtil.getMockJdk17("MyJDK");
edt(() -> ApplicationManager.getApplication().runWriteAction(() -> ProjectJdkTable.getInstance().addJdk(myJdk, myProject)));
importProject(
"""
apply plugin: 'java'
apply plugin: 'idea'
... | public void testCompilerArguments() {
createProjectConfig(script(it -> it
.withJavaPlugin()
.configureTask("compileTestJava", "JavaCompile", task -> {
task.code("options.compilerArgs << '-param1' << '-param2'");
})
));
importProject();
assertModules("project", "project.main", "... | java | 2025-01-27T18:24:52 |
JetBrains/intellij-community | f1a3121ea4c92db85772bbaa9b40e087fc2f9f76 | plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/model/DefaultExternalSourceSet.java | // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.gradle.model;
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType;
import org.jetbrains.annotations.NotNull;
import or... |
}
@Override
public @NotNull Collection<File> getArtifacts() {
return artifacts;
}
public void setArtifacts(@NotNull Collection<File> artifacts) {
this.artifacts = artifacts;
}
@Override
public @NotNull Collection<ExternalDependency> getDependencies() {
return dependencies;
}
public ... | }
@Override
public @NotNull List<String> getCompilerArguments() {
return Collections.unmodifiableList(
Objects.requireNonNull(compilerArguments, "The source set's compilerArguments property has not been initialized")
);
}
public void setCompilerArguments(@NotNull List<String> compilerArguments) ... | java | 2025-01-27T18:24:52 |
JetBrains/intellij-community | 22696c58a88f62e4a4f5269f8961b803e885e439 | plugins/gradle/src/org/jetbrains/plugins/gradle/frameworkSupport/buildscript/KotlinDslGradleBuildScriptBuilder.kt | // Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.gradle.frameworkSupport.buildscript
import org.gradle.util.GradleVersion
import org.jetbrains.annotations.ApiStatus
import org.jet... |
override fun withKotlinJvmPlugin(version: String?): Self = apply {
withMavenCentral()
withPlugin {
if (version != null) {
infixCall(call("kotlin", "jvm"), "version", string(version))
} else {
call("kotlin", "jvm")
}
}
}
override fun withKotlinTest(): Self = apply {... | private val PREDEFINED_TASKS = setOf("test", "compileJava", "compileTestJava")
override fun configureTask(name: String, type: String, configure: ScriptTreeBuilder.() -> Unit): Self =
withPostfix {
val block = tree(configure)
if (!block.isEmpty()) {
if (name in PREDEFINED_TASKS) {
ca... | kotlin | 2025-01-28T13:24:59 |
JetBrains/intellij-community | e277fe13628bf2ff4cf4877a8d9302c1d3627b56 | platform/platform-impl/codeinsight-inline/src/com/intellij/codeInsight/inline/completion/logs/InlineCompletionLogs.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.inline.completion.logs
import com.intellij.codeInsight.inline.completion.logs.InlineCompletionLogsContainer.Phase
import com.intellij.internal.statistic.eventLog.Eve... |
object Session {
private val phaseToFieldList: List<Pair<Phase, EventFieldExt<*>>> = run {
val fields = Cancellation.withNonCancelableSection().use {
// Non-cancellable section, because this function is often used in
// static initializer code of `object`, and any exception (namely, Cancel... | private val EP_NAME = ExtensionPointName.create<StatisticsEventLoggerProvider>("com.intellij.statistic.eventLog.eventLoggerProvider")
private val mlRecorder = lazy {
EP_NAME.extensionList.firstOrNull { it.recorderId == "ML" }
}
// most essential logs
private val essentialLogs = listOf("experiment_group", ... | kotlin | 2025-01-14T09:01:00 |
JetBrains/intellij-community | e277fe13628bf2ff4cf4877a8d9302c1d3627b56 | platform/statistics/src/com/intellij/internal/statistic/eventLog/StatisticsEventLogger.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.internal.statistic.eventLog
import com.intellij.ide.plugins.ProductLoadingStrategy
import com.intellij.idea.AppMode
import com.intellij.internal.statistic.StatisticsServiceScope... |
@Deprecated(message = "Use primary constructor instead")
constructor(recorderId: String,
version: Int,
sendFrequencyMs: Long,
maxFileSizeInBytes: Int) : this(recorderId, version, sendFrequencyMs, maxFileSizeInBytes, false)
companion object {
@JvmStatic
val EP_N... | open val coroutineScope: CoroutineScope = StatisticsServiceScope.getScope()
@ApiStatus.Internal
val recorderOptionsProvider: RecorderOptionProvider
init {
// add existing options
val configOptionsService = EventLogConfigOptionsService.getInstance()
recorderOptionsProvider = RecorderOptionProvider(co... | kotlin | 2025-01-14T09:01:00 |
JetBrains/intellij-community | 16dccf1eceb9c06d7c0669683b19f6608051a7ed | plugins/kotlin/code-insight/utils/src/org/jetbrains/kotlin/idea/codeinsight/utils/ControlFlowUtils.kt | // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.codeinsight.utils
import com.intellij.psi.util.parentsOfType
import org.jetbrains.kotlin.idea.references.mainReference
import org.jetbrains.kotlin.lexer.KtTokens
im... |
private fun KtExpression.includesCallOf(function: KtNamedFunction): Boolean {
val refDescriptor = mainReference?.resolve()
return function == refDescriptor || anyDescendantOfType<KtExpression> {
it !== this && it !is KtLabelReferenceExpression && function == it.mainReference?.resolve()
}
}
| fun canExplicitTypeBeRemoved(element: KtDeclaration): Boolean {
val typeReference = element.typeReference ?: return false
fun canBeRemovedByTypeReference(element: KtDeclaration, typeReference: KtTypeReference): Boolean =
!typeReference.isAnnotatedDeep() && !element.isExplicitTypeReferenceNeededForTypeI... | kotlin | 2025-01-28T16:54:07 |
JetBrains/intellij-community | 7cee3dd3c507b64e04e1c8c09515ff27a64ad89b | plugins/kotlin/base/project-structure/src/org/jetbrains/kotlin/idea/base/projectStructure/IDEProjectStructureProvider.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.base.projectStructure
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.platform.workspace.jps.entities.Li... |
abstract fun getKaSourceModule(moduleId: ModuleId, type: KaSourceModuleKind): KaSourceModule?
abstract fun getKaSourceModule(moduleEntity: ModuleEntity, kind: KaSourceModuleKind): KaSourceModule?
abstract fun getKaSourceModuleKind(module: KaSourceModule): KaSourceModuleKind
abstract fun getKaSource... | /**
* Needed for [org.jetbrains.kotlin.idea.base.fir.projectStructure.DelegatingIDEProjectStructureProvider] to know the real provider.
*
* It's a temporary variable needed until we have [DelegatingIDEProjectStructureProvider]
*/
abstract val self: IDEProjectStructureProvider | kotlin | 2024-11-18T16:16:03 |
JetBrains/intellij-community | 7cee3dd3c507b64e04e1c8c09515ff27a64ad89b | plugins/kotlin/base/project-structure/src/org/jetbrains/kotlin/idea/base/projectStructure/modules/KaSourceModuleForOutsider.kt | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.base.projectStructure.modules
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.annotations.ApiStatu... |
@ApiStatus.Internal
interface KaSourceModuleForOutsider : KaSourceModule {
val fakeVirtualFile: VirtualFile
val originalVirtualFile: VirtualFile?
fun adjustContentScope(scope: GlobalSearchScope): GlobalSearchScope {
val scopeWithFakeFile = GlobalSearchScope.fileScope(project, fakeVirtualFile).unit... | /**
* A [KaSourceModule] for a file that does not directly belong to a project, serving as a substitution for an existing project source file.
*
* The original file is represented by [originalVirtualFile], and the substitution file is represented by [fakeVirtualFile].
*
* A good example of an outsider file is a fi... | kotlin | 2024-11-18T16:16:03 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.