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
JetBrains/intellij-community
a891bc5b664913b59cfe2d50f416114315bb814f
java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/StatementChecker.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.codeInsight.ExceptionUtil; import com.intellij.core.JavaPsiBundle; import com.intellij.java.codeserver.highlighting.errors.Java...
private static boolean checkMultipleTypes(@NotNull PsiClass catchClass, @NotNull List<? extends PsiType> upperCatchTypes) { for (int i = upperCatchTypes.size() - 1; i >= 0; i--) { if (checkSingleType(catchClass, upperCatchTypes.get(i))) return true; } return false; } private static boolean ch...
void checkBreakTarget(@NotNull PsiBreakStatement statement) { PsiIdentifier label = statement.getLabelIdentifier(); PsiStatement target = statement.findExitedStatement(); if (target == null) { if (label != null) { myVisitor.report(JavaErrorKinds.LABEL_UNRESOLVED.create(label)); } else { ...
java
2025-01-27T17:03:39
JetBrains/intellij-community
37db69a7b5e202694c851d948956abfa3c92f6ac
plugins/devkit/devkit-core/src/dom/impl/ActionOrGroupPresentationProvider.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.idea.devkit.dom.impl; import com.intellij.icons.AllIcons; import com.intellij.ide.presentation.PresentationProvider; import com.intellij.openapi.util.IconLoader; import com.int...
} } return null; } private static @Nullable Icon getIconFromReference(@NotNull PsiReference reference) { PsiElement resolved = reference.resolve(); if (!(resolved instanceof PsiField)) { return null; } UField field = UastContextKt.toUElement(resolved, UField.class); assert ...
} } return null; } private static @Nullable ActionOrGroup resolveActionOrGroup(@Nullable GenericDomValue<String> actionOrGroupReferenceDomElement) { if (actionOrGroupReferenceDomElement == null) return null; XmlElement xmlElement = actionOrGroupReferenceDomElement.getXmlElement(); if (xmlElemen...
java
2025-01-28T14:24:31
JetBrains/intellij-community
601d81cce04392dad80888c941ecda3f5f6c3f92
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/ClientLookupManager.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.lookup.impl import com.intellij.codeInsight.completion.impl.CamelHumpMatcher import com.intellij.codeInsight.lookup.LookupArranger import com.intellij.codeInsight.lo...
@Internal class LocalClientLookupManager(session: ClientProjectSession) : ClientLookupManagerBase(session) { override fun createLookup(editor: Editor, arranger: LookupArranger, session: ClientProjectSession): LookupImpl { return LookupImpl(session, editor, arranger) } } @Internal class GuestLookupManager(ses...
@ApiStatus.Experimental @Internal val LOOKUP_CUSTOMIZATION_EP: ExtensionPointName<LookupCustomizer> = ExtensionPointName("com.intellij.lookup.customizer") /** * Represents a customization mechanism for a lookup interface. Classes implementing this * interface can provide additional configurations or modifications to...
kotlin
2025-01-24T21:47:21
JetBrains/intellij-community
601d81cce04392dad80888c941ecda3f5f6c3f92
platform/platform-impl/src/com/intellij/codeInsight/lookup/CharFilter.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.codeInsight.lookup; import com.intellij.openapi.editor.impl.EditorImpl; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.util.Key; import ...
public enum Result { /** * Indicates that typed character should be appended to current prefix and completion session should continue */ ADD_TO_PREFIX, /** * Indicates that completion session should be finished and the currently selected item should be inserted to the document */ ...
/** * A static key used to control the suppression of default frontend char filters in the Lookup implementation. * Used with {@link EditorImpl} * Now default char filters can choose between different results. * If this flag is active, the last filter will return always ADD_TO_PREFIX */ @ApiStatus.Inte...
java
2025-01-24T21:47:21
JetBrains/intellij-community
879280e32e7db2c591902e0a2c2857a29f64a5bd
plugins/kotlin/refactorings/kotlin.refactorings.common/src/org/jetbrains/kotlin/idea/refactoring/inline/codeInliner/CodeToInline.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.idea.refactoring.inline.codeInliner import com.intellij.openapi.util.Key
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtExpression /** * Represents code to be inlined to replace usages of particular callable. * The expression should be preprocessed in the following way: * * Type arguments for all calls should be mad...
import org.jetbrains.kotlin.idea.refactoring.inline.codeInliner.CodeToInline.Companion.PARAMETER_USAGE_KEY import org.jetbrains.kotlin.idea.refactoring.inline.codeInliner.CodeToInline.Companion.TYPE_PARAMETER_USAGE_KEY
kotlin
2025-01-27T19:09:02
JetBrains/intellij-community
bbfb996bb11430c1569ef66f2f7a6f2b4e191770
plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/KotlinFirUnresolvedReferenceQuickFixProvider.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.codeinsight.fixes import com.intellij.codeInsight.daemon.QuickFixActionRegistrar import com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider imp...
class KotlinFirUnresolvedReferenceQuickFixProvider : UnresolvedReferenceQuickFixProvider<PsiReference>() { override fun registerFixes(reference: PsiReference, registrar: QuickFixActionRegistrar) { val ktElement = reference.element as? KtElement ?: return if(ktElement.module?.isMultiPlatformModule ...
/** * A provider for quick-fixes related to unresolved references in Kotlin for K2 Mode. * * Used as a lazy alternative to registering factories in [KotlinK2QuickFixRegistrar] to * postpone some work during the highlighting (see KTIJ-26874). * * Triggered from [org.jetbrains.kotlin.idea.highlighting.visitor.Kotl...
kotlin
2025-01-27T17:09:23
JetBrains/intellij-community
4b94cd67e68fddd3fc5b3a1d597c5b20b09eadd0
java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/StatementChecker.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.codeInsight.ExceptionUtil; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKinds; import com.intellij.java.cod...
private static boolean checkMultipleTypes(@NotNull PsiClass catchClass, @NotNull List<? extends PsiType> upperCatchTypes) { for (int i = upperCatchTypes.size() - 1; i >= 0; i--) { if (checkSingleType(catchClass, upperCatchTypes.get(i))) return true; } return false; } private static boolean ch...
void checkTryResourceIsAutoCloseable(@NotNull PsiResourceListElement resource) { PsiType type = resource.getType(); if (type == null) return; PsiElementFactory factory = JavaPsiFacade.getElementFactory(resource.getProject()); PsiClassType autoCloseable = factory.createTypeByFQClassName(CommonClassNames...
java
2025-01-27T14:42:10
JetBrains/intellij-community
4f1d532d49c94c330224707f7c5dc5f030d2a102
plugins/kotlin/base/kdoc/src/org/jetbrains/kotlin/idea/kdoc/KDocElementFactory.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.kdoc import com.intellij.openapi.project.Project import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.kotlin.kdoc.psi.api.KDoc import org.jetbrains.kotlin...
} fun createNameFromText(text: String): KDocName { val kdocText = "/** @param $text foo*/" val kdoc = createKDocFromText(kdocText) val section = kdoc.getDefaultSection() val tag = section.findTagByName("param") val link = tag?.getSubjectLink() ?: throw IllegalArgumentEx...
} fun createQualifiedKDocName(text: String): KDocName { val kdocText = "/** [$text] */" val kdoc = createKDocFromText(kdocText) val section = kdoc.getDefaultSection() val mdLink = section.getChildOfType<KDocLink>()!! return mdLink.getChildOfType<KDocName>()!!
kotlin
2025-01-27T14:37:20
JetBrains/intellij-community
512bae6ff7738817c3e9f407bee8c427df02bc58
plugins/devkit/devkit-core/src/references/ActionOrGroupIdReference.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.idea.devkit.references; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementBuilder; import com.intellij.execution.Executo...
} @Override public Object @NotNull [] getVariants() { ActionOrGroupResolveConverter converter; if (myIsAction == ThreeState.YES) { converter = new ActionOrGroupResolveConverter.OnlyActions(); } else if (myIsAction == ThreeState.NO) { converter = new ActionOrGroupResolveConverter.Only...
} private @Nullable PsiElement resolveExecutor(Project project) { Ref<PsiElement> executor = Ref.create(); PairProcessor<String, PsiClass> pairProcessor = (id, psiClass) -> { if (StringUtil.equals(id, myId)) { executor.set(psiClass); return false; } return true; }; A...
java
2025-01-27T15:03:54
JetBrains/intellij-community
512bae6ff7738817c3e9f407bee8c427df02bc58
plugins/devkit/devkit-core/src/util/ExtensionLocator.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.idea.devkit.util import com.intellij.openapi.project.Project import com.intellij.openapi.util.text.StringUtil import com.intellij.psi.PsiClass import com.intellij.psi.SmartPoin...
/** * @param extensionPointId To locate a specific extension instance by ID or `null` to process all. * @param nameElementFunction Returns the DOM `id` element when [extensionPointId] is passed. */ private fun processExtensionCandidates( project: Project, extensionPointFqn: String, processor: Processor<in Ex...
fun processAllExtensionCandidates( project: Project, extensionPointFqn: String, processor: Processor<in Extension>, ) { processExtensionCandidates(project, extensionPointFqn, processor, null, null) } fun findExtensionCandidate( project: Project, extensionPointFqn: String, processor: Processor<in Extensio...
kotlin
2025-01-27T15:03:54
JetBrains/intellij-community
ba44207258c41af328d20fbe30f2c7e449ab3b02
plugins/kotlin/refactorings/kotlin.refactorings.common/src/org/jetbrains/kotlin/idea/refactoring/kotlinCommonRefactoringUtil.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.refactoring import com.intellij.lang.java.JavaLanguage import com.intellij.openapi.project.Project import com.intellij.psi.* import com.intellij.psi.util.PsiTreeUti...
fun KtNamedDeclaration.getDeclarationBody(): KtElement? = when (this) { is KtClassOrObject -> getSuperTypeList() is KtPrimaryConstructor -> getContainingClassOrObject().getSuperTypeList() is KtSecondaryConstructor -> getDelegationCall() is KtNamedFunction -> bodyExpression else -> null } fun KtEl...
context(KaSession) @ApiStatus.Internal fun KtCallExpression.canMoveLambdaOutsideParentheses( skipComplexCalls: Boolean = true ): Boolean { if (skipComplexCalls && isComplexCallWithLambdaArgument()) { return false } if (getStrictParentOfType<KtDelegatedSuperTypeEntry>() != null) { return...
kotlin
2025-01-27T11:30:54
JetBrains/intellij-community
9361a37142825569a6404ed313f3ad6094dafeed
plugins/evaluation-plugin/languages/python/src/com/intellij/cce/python/execution/output/PythonErrorLogProcessor.kt
package com.intellij.cce.python.execution.output import com.intellij.cce.execution.output.ProcessExecutionLog interface PythonErrorLogProcessor {
fun getTestExecutionSuccessRate(executionLog: ProcessExecutionLog): Double }
/** * Calculates the success rate of test execution based on the provided execution log. * The success rate is determined as the ratio of successfully executed tests * to the total number of tests executed. * * @param executionLog The execution log containing information about test execution including ...
kotlin
2025-01-20T16:47:17
JetBrains/intellij-community
c52358eecdbd3ccc4bc4d1074c166a614f040bd1
python/helpers/pydev/pydev_tests_tables/test_pydev_tensorflow_without_pandas.py
# Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. import pytest import tensorflow as tf import sys from IPython.display import HTML import _pydevd_bundle.tables.pydevd_numpy_based as numpy_based_tables_helpers from _pydevd_bundle.pydevd_constants...
def __check_info_tf_tensor(arr, file): actual = [numpy_based_tables_helpers.get_type(arr), NEXT_VALUE_SEPARATOR, numpy_based_tables_helpers.get_shape(arr), NEXT_VALUE_SEPARATOR, numpy_based_tables_helpers.get_head(arr), NEXT_VALUE_SEPARATOR, ...
# variable tensors tests # 30 def test_variable_tensor_1d(): variable_tensor = tf.Variable([1, 2, 3]) __check_info_tf_tensor(variable_tensor, 'test_data/numpy_based_without_pandas/tensorflow_without_pandas/' + test_data_directory + '/tensorflow_variable_1d_number.txt') # 31 def test_variable_tensor_3d_simple(...
python
2025-01-16T22:15:54
JetBrains/intellij-community
9b7a26add39bbeab028e5834cd17c067eec3b987
python/helpers/pydev/pydev_tests_tables/test_pydev_tensorflow_without_pandas.py
# Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. import pytest import tensorflow as tf import sys from IPython.display import HTML import _pydevd_bundle.tables.pydevd_numpy_based as numpy_based_tables_helpers from _pydevd_bundle.pydevd_constants...
def __check_info_tf_tensor(arr, file): actual = [numpy_based_tables_helpers.get_type(arr), NEXT_VALUE_SEPARATOR, numpy_based_tables_helpers.get_shape(arr), NEXT_VALUE_SEPARATOR, numpy_based_tables_helpers.get_head(arr), NEXT_VALUE_SEPARATOR, ...
# sparse tensors tests # 17 def test_sparse_tensor_1d_number(): sparse_tensor = tf.sparse.SparseTensor( indices=[[0], [1], [2]], values=[1, 2, 3], dense_shape=[3] ) __check_info_tf_tensor(sparse_tensor, 'test_data/numpy_based_without_pandas/tensorflow_witho...
python
2025-01-16T01:17:02
JetBrains/intellij-community
f6f816631053e5c849e1280e23152973605785cc
python/helpers/pydev/pydev_tests_tables/test_pydev_numpy_with_pandas.py
# Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. import numpy as np import pytest import sys from IPython.display import HTML import _pydevd_bundle.tables.pydevd_numpy as numpy_tables_helpers from _pydevd_bundle.pydevd_constants import NEXT_VALUE...
def __check_info_np_array(arr, file): actual = [numpy_tables_helpers.get_type(arr), NEXT_VALUE_SEPARATOR, numpy_tables_helpers.get_shape(arr), NEXT_VALUE_SEPARATOR, numpy_tables_helpers.get_head(arr), NEXT_VALUE_SEPARATOR, numpy_...
#15 TODO: fix wrong float formatting # def test_display_data_csv_float_values(mocker, setup_np_array_with_floats): # np_array = setup_np_array_with_floats # # # Mock the CSV and display functions # mock_print = mocker.patch('builtins.print') # # actual = numpy_tables_helpers.display_data_csv(np_array, 0...
python
2024-12-27T23:00:27
JetBrains/intellij-community
f6f816631053e5c849e1280e23152973605785cc
python/helpers/pydev/pydev_tests_tables/test_pydev_numpy_without_pandas.py
# Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. import numpy as np import pytest import sys from IPython.display import HTML import _pydevd_bundle.tables.pydevd_numpy as numpy_tables_helpers from _pydevd_bundle.pydevd_constants import NEXT_VALUE...
def __check_info_np_array(arr, file): actual = [numpy_tables_helpers.get_type(arr), NEXT_VALUE_SEPARATOR, numpy_tables_helpers.get_shape(arr), NEXT_VALUE_SEPARATOR, numpy_tables_helpers.get_head(arr), NEXT_VALUE_SEPARATOR, numpy_...
# 15 def test_display_data_csv_float_values(mocker, setup_np_array_with_floats): np_array = setup_np_array_with_floats # Mock the CSV and display functions mock_print = mocker.patch('builtins.print') actual = numpy_tables_helpers.display_data_csv(np_array, 0, 3) called_args, called_kwargs = mock_...
python
2024-12-27T23:00:27
JetBrains/intellij-community
f6f816631053e5c849e1280e23152973605785cc
python/helpers/pydev/pydev_tests_tables/test_pydev_tensorflow_with_pandas.py
# Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. import pytest import tensorflow as tf import sys from IPython.display import HTML import _pydevd_bundle.tables.pydevd_numpy_based as numpy_based_tables_helpers from _pydevd_bundle.pydevd_constants...
def __read_expected_from_file_and_compare_with_actual(actual, expected_file): with open(expected_file, 'r') as in_f: expected = in_f.read() # print(actual) # print(expected) assert len(expected) > 0 # for a more convenient assertion fails messages here we compare string char by char ...
# 15 def test_display_data_csv_float_values(mocker, setup_tf_tensor_with_floats): tf_tensor = setup_tf_tensor_with_floats # Mock the CSV and display functions mock_print = mocker.patch('builtins.print') actual = numpy_based_tables_helpers.display_data_csv(tf_tensor, 0, 3) called_args, called_kwarg...
python
2024-12-27T23:00:27
JetBrains/intellij-community
f6f816631053e5c849e1280e23152973605785cc
python/helpers/pydev/pydev_tests_tables/test_pydev_torch_with_pandas.py
# Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. import pytest import torch import sys from IPython.display import HTML import _pydevd_bundle.tables.pydevd_numpy_based as numpy_based_tables_helpers from _pydevd_bundle.pydevd_constants import NEX...
def __read_expected_from_file_and_compare_with_actual(actual, expected_file): with open(expected_file, 'r') as in_f: expected = in_f.read() # print(actual) # print(expected) assert len(expected) > 0 # for a more convenient assertion fails messages here we compare string char by char ...
# 15 def test_display_data_csv_float_values(mocker, setup_torch_tensor_with_floats): torch_tensor = setup_torch_tensor_with_floats # Mock the CSV and display functions mock_print = mocker.patch('builtins.print') actual = numpy_based_tables_helpers.display_data_csv(torch_tensor, 0, 3) called_args, ...
python
2024-12-27T23:00:27
JetBrains/intellij-community
52bfa7fc8afdcbbe7742b93b85455e2272483470
plugins/terminal/src/org/jetbrains/plugins/terminal/block/reworked/TerminalOutputModelImpl.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.block.reworked import com.intellij.openapi.Disposable import com.intellij.openapi.editor.Document import com.intellij.terminal.TerminalColorPalette import com....
highlightingsModel.removeAfter(replaceStartOffset) highlightingsModel.addHighlightings(replaceStartOffset, styles) val trimmedCount = trimToSize() return replaceStartOffset - trimmedCount } /** Returns trimmed characters count */ private fun trimToSize(): Int { return if (maxOutputLength ...
// If the document became shorter, immediately ensure that the cursor is still within the document. // It'll update itself later to the correct position anyway, but having the incorrect value can cause exceptions before that. val newLength = document.textLength if (mutableCursorOffsetState.value > newLength...
kotlin
2025-01-24T10:26:36
JetBrains/intellij-community
8d08ee59b0ad48b68c54bc45edd68e7bcef4f2be
platform/remote-driver/test-sdk/src/com/intellij/driver/sdk/PluginManager.kt
package com.intellij.driver.sdk import com.intellij.driver.client.Driver import com.intellij.driver.client.Remote fun Driver.getPlugin(id: String) = utility(PluginManagerCore::class).getPlugin(utility(PluginId::class).getId(id)) fun Driver.getEnabledPlugins() = utility(PluginManagerCore::class).getLoadedPlugins()
@Remote("com.intellij.openapi.extensions.PluginId") interface PluginId { fun getId(id: String): PluginId fun getIdString(): String } @Remote("com.intellij.ide.plugins.PluginManagerCore") interface PluginManagerCore { fun getPlugin(pluginId: PluginId): PluginDescriptor? fun getLoadedPlugins(): Array<PluginDes...
fun Driver.getDisabledPlugins(enabledPlugins: Set<String>): List<String> { val actual = getEnabledPluginsIds() return enabledPlugins.minus(actual).filter { val plugin = getPlugin(it) // plugin == null means removed plugins since this is not obvious. // plugin.getName() == "IDEA CORE" means moved/renamed...
kotlin
2025-01-27T09:49:49
JetBrains/intellij-community
422cd98ddbdf171dafbbe774d11aba90ec921911
platform/platform-tests/testSrc/com/intellij/ide/plugins/PluginDependenciesTest.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.ide.plugins import com.intellij.ide.plugins.cl.PluginClassLoader import com.intellij.openapi.extensions.PluginId import com.intellij.testFramework.assertions.Assertions.assertTh...
fun `content module in separate JAR`() { val pluginDir = pluginDirPath.resolve("sample-plugin") PluginBuilder() .noDepends() .id("sample.plugin") .module("dep", PluginBuilder(), separateJar = true) .build(pluginDir) val result = buildPluginSet() assertThat(result.enabledPlugin...
fun `dependencies between plugin modules`() { PluginBuilder() .noDepends() .id("sample.plugin") .module("embedded.module", PluginBuilder().packagePrefix("embedded"), loadingRule = ModuleLoadingRule.EMBEDDED) .module("required.module", PluginBuilder().packagePrefix("required").dependency("emb...
kotlin
2025-01-24T10:49:22
JetBrains/intellij-community
9f892001efbb714860789a07188d2756131ea3f9
platform/core-impl/src/com/intellij/ide/plugins/PluginSet.kt
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. @file:Suppress("ReplaceGetOrSet") package com.intellij.ide.plugins import com.intellij.openapi.extensions.PluginId import com.intellij.util.Java11Shim import org.jetbrains.annotations.ApiStatus impo...
@TestOnly fun getUnsortedEnabledModules(): Collection<IdeaPluginDescriptorImpl> = Java11Shim.INSTANCE.copyOf(enabledModuleMap.values) fun isPluginInstalled(id: PluginId): Boolean = findInstalledPlugin(id) != null fun findInstalledPlugin(id: PluginId): IdeaPluginDescriptorImpl? = allPlugins.find { it.pluginI...
val allModulesSorted: List<IdeaPluginDescriptorImpl> get() = sortedModulesWithDependencies.modules internal fun getSortedDependencies(moduleDescriptor: IdeaPluginDescriptorImpl): List<IdeaPluginDescriptorImpl> { return sortedModulesWithDependencies.directDependencies.getOrDefault(moduleDescriptor, Collection...
kotlin
2025-01-22T15:46:24
JetBrains/intellij-community
a92be4643e19fc147c1d0c2d19f30720533e28c9
platform/core-api/src/com/intellij/util/coroutines.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.application.ModalityState import com.intellij.openapi.application.asContextElement import com.intellij.platform.util.coroutines.requireNoJob imp...
/** * Awaits cancellation of [this] scope, and executes [action] in the context dispatcher of the scope after the scope is canceled. * NB: this function prevents normal completion of the scope, so it should be used for scopes which don't complete normally anyway. * * Standard [Job.invokeOnCompletion] does not pro...
@RequiresOptIn( message = "By using this API I confirm that I understand that the scope will not be able to complete normally and I understand that the cleaner coroutine is non-cancellable.", level = RequiresOptIn.Level.WARNING, ) annotation class AwaitCancellationAndInvoke
kotlin
2025-01-21T11:44:52
JetBrains/intellij-community
7985564a73eb9e59776d231a8a8dac5d3c436be4
plugins/kotlin/code-insight/inspections-shared/tests/k1/test/org/jetbrains/kotlin/idea/codeInsight/inspections/shared/SharedK1InspectionTestGenerated.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.codeInsight.inspections.shared; import com.intellij.testFramework.TestDataPath; import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode; import org.jetbrains...
@TestMetadata("../testData/inspections/naming") public abstract static class Naming extends AbstractSharedK1InspectionTest { @RunWith(JUnit3RunnerWithInners.class) @TestMetadata("../testData/inspections/naming/class") public abstract static class Class extends Abstra...
@TestMetadata("../testData/inspections/forEachParameterNotUsed") public abstract static class ForEachParameterNotUsed extends AbstractSharedK1InspectionTest { @RunWith(JUnit3RunnerWithInners.class) @TestMetadata("../testData/inspections/forEachParameterNotUsed/inspectionData") ...
java
2025-01-25T19:55:20
JetBrains/intellij-community
7985564a73eb9e59776d231a8a8dac5d3c436be4
plugins/kotlin/code-insight/inspections-shared/tests/k2/test/org/jetbrains/kotlin/idea/k2/codeInsight/inspections/shared/SharedK2InspectionTestGenerated.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.codeInsight.inspections.shared; import com.intellij.testFramework.TestDataPath; import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode; import org.jetbra...
@TestMetadata("../testData/inspections/naming") public abstract static class Naming extends AbstractSharedK2InspectionTest { @RunWith(JUnit3RunnerWithInners.class) @TestMetadata("../testData/inspections/naming/class") public abstract static class Class extends Abstra...
@TestMetadata("../testData/inspections/forEachParameterNotUsed") public abstract static class ForEachParameterNotUsed extends AbstractSharedK2InspectionTest { @RunWith(JUnit3RunnerWithInners.class) @TestMetadata("../testData/inspections/forEachParameterNotUsed/inspectionData") ...
java
2025-01-25T19:55:20
JetBrains/intellij-community
faae424c7269af578de75bbf8d9b15dc880fb297
platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelPathUtils.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.eel.provider.utils import com.intellij.openapi.components.Service import com.intellij.openapi.components.service import com.intellij.openapi.diagnostic.thisLogger impor...
fun getHomePath(descriptor: EelDescriptor): Path { // usually eel is already initialized to this moment @Suppress("RAW_RUN_BLOCKING") val api = runBlocking { descriptor.upgrade() } val someEelPath = api.fs.user.home return someEelPath.asNioPath() } @RequiresBackgroundThread fun w...
/** * Transfers a local file to a remote temporary environment if required. * * This function is useful for transferring files that are located on the local machine * to a remote environment. It can be particularly helpful for files stored in plugin * resources, such as: * * ```kotlin * Path.of(...
kotlin
2025-01-22T11:44:00
JetBrains/intellij-community
faae424c7269af578de75bbf8d9b15dc880fb297
platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelUtils.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.eel.provider.utils import com.intellij.openapi.progress.runBlockingMaybeCancellable import com.intellij.platform.eel.EelExecApi import com.intellij.platform.eel.EelPlat...
} @Throws(FileSystemException::class) fun <T, E : EelFsError> EelResult<T, E>.getOrThrowFileSystemException(): T = when (this) { is EelResult.Ok -> value is EelResult.Error -> error.throwFileSystemException() } // TODO There's java.nio.file.FileSystemLoopException, so ELOOP should be added to all error c...
} fun CpuArch.toEelArch(): EelPlatform.Arch = when (this) { CpuArch.X86 -> EelPlatform.X86 CpuArch.X86_64 -> EelPlatform.X86_64 CpuArch.ARM32 -> EelPlatform.ARM_32 CpuArch.ARM64 -> EelPlatform.ARM_64 CpuArch.OTHER, CpuArch.UNKNOWN -> EelPlatform.Unknown
kotlin
2025-01-22T11:44:00
JetBrains/intellij-community
5fc68912a54352282fb54d50da3d76e0a053ed6a
platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelChannelUtils.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.eel.provider.utils import com.intellij.openapi.progress.Cancellation.ensureActive import com.intellij.platform.eel.EelResult import com.intellij.platform.eel.ReadResult...
/** * Bidirectional [kotlinx.coroutines.channels.Channel.RENDEZVOUS] pipe much like [java.nio.channels.Pipe]. * Closing [sink] makes [source] return [com.intellij.platform.eel.ReadResult.EOF] * Closing [source] makes [sink] return and [IOException] * Calling [closePipe] closes both [sink] and [source], you might ...
/** * Reads data from [receiveChannel] with buffer as big as [bufferSize] and returns it from channel (until [receiveChannel] is closed) * Each buffer is fresh (not reused) but not flipped. * Errors are thrown out of the channel (directly or wrapped with [IOException] if not throwable). */ fun CoroutineScope.consum...
kotlin
2025-01-24T01:23:25
JetBrains/intellij-community
5fc68912a54352282fb54d50da3d76e0a053ed6a
platform/platform-tests/testSrc/com/intellij/execution/eel/EelChannelToolsTest.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.execution.eel import com.intellij.platform.eel.EelResult import com.intellij.platform.eel.ReadResult import com.intellij.platform.eel.ReadResult.EOF import com.intellij.platform...
} } /** * Writes bytes nor more than [blockSize] at once, get data with [toByteArray] */ private class ByteArrayChannelLimited(private val blockSize: Int) : WritableByteChannel { private val byteArrayOutputStream = ByteArrayOutputStream() @Volatile private var closed = false override fun write(src: ByteB...
} @CartesianTest fun testKotlinChannel( @IntRangeSource(from = 1, to = TEXT.length + 1) srcBlockSize: Int, ): Unit = timeoutRunBlocking { val eelChannel = ByteArrayInputStreamLimited(data, srcBlockSize).consumeAsEelChannel() val kotlinChannel = consumeReceiveChannelAsKotlin(eelChannel) val result...
kotlin
2025-01-24T01:23:25
JetBrains/intellij-community
65b17608ab8205e81d437f894dd4097cb23c7686
platform/lang-impl/src/com/intellij/codeInsight/highlighting/HyperlinkAnnotator.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.codeInsight.highlighting; import com.intellij.codeInsight.daemon.impl.HighlightInfoType; import com.intellij.ide.IdeBundle; import com.intellij.lang.ContributedReferencesAnnotat...
Shortcut[] shortcuts = requireNonNull(KeymapManager.getInstance()).getActiveKeymap().getShortcuts(IdeActions.ACTION_GOTO_DECLARATION); String shortcutText = ""; Shortcut mouseShortcut = ContainerUtil.find(shortcuts, shortcut -> !shortcut.isKeyboard()); if (mouseShortcut != null) { shortcutText +=...
String shortcutsText = getGoToDeclarationShortcutsText(); if (!shortcutsText.isEmpty()) { return message + " (" + shortcutsText + ")"; } return message; } /** * Returns a comma-separated list of shortcuts assigned to the 'Go To Declaration' action. * This list includes up to two shortcuts: ...
java
2025-01-22T16:03:17
JetBrains/intellij-community
0d3a78b4b5e279d07ec4c46fc2bea4e6acf4f5fb
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/completion/cache/AsyncLocalCache.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.openapi.externalSystem.service.ui.completion.cache import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.Deferred import kotlinx.coroutines.completeWith import...
val deferred = CompletableDeferred<T>() val valueDeferred = valueDeferredCache.getOrCreateValue(stamp) { deferred } if (valueDeferred === deferred) { deferred.completeWith(runCatching { createValue() }) } val value = valueDeferred.getValue() return valueCache.getOrCreateValu...
return getOrCreateValue(stamp, { createValue() }, { await() }) } fun getOrCreateValueBlocking(stamp: Long, createValue: () -> T): T { return getOrCreateValue(stamp, { createValue() }, { asCompletableFuture().get() }) } private inline fun getOrCreateValue(stamp: Long, createValue: () -> T, getValue: Deferr...
kotlin
2025-01-23T16:34:56
JetBrains/intellij-community
1f878a422a10e8ccbd15cb69b42b9d1f52bcf566
plugins/git4idea/tests/git4idea/commit/signing/PinentryExecutionTest.kt
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package git4idea.commit.signing import com.intellij.execution.configurations.GeneralCommandLine import com.intellij.execution.process.* import com.intellij.openapi.components.service import com.inte...
private fun configureGpgAgent(gpgAgentPaths: GpgAgentPaths, pinetryFallback: String = "pinentry") { project.service<GpgAgentConfigurator>().doConfigure(GitExecutableManager.getInstance().getExecutable(project), gpgAgentPaths, pinetryFallback) } private fun assertScriptContentStructure(scriptContent: String...
fun `test config read after pinentry update`() { IoTestUtil.assumeUnix() val paths = createPathLocator().resolvePaths()!! val pinentryFallback = "/usr/bin/pinentry-old" configureGpgAgent(paths, pinentryFallback) val config = GpgAgentConfig.readConfig(paths.gpgAgentConf).getOrThrow() checkNotNul...
kotlin
2025-01-14T13:45:57
JetBrains/intellij-community
02f5e3f522efae780d33c8b494b91650ccdb038d
python/python-psi-impl/src/com/jetbrains/python/psi/impl/stubs/PyTypeAliasStatementElementType.java
package com.jetbrains.python.psi.impl.stubs; import com.google.common.collect.RangeSet; import com.intellij.lang.ASTNode; import com.intellij.openapi.util.Version; import com.intellij.psi.PsiElement; import com.intellij.psi.stubs.*; import com.jetbrains.python.PyStubElementTypes; import com.jetbrains.python.psi.PyStub...
} @Override public void serialize(@NotNull PyTypeAliasStatementStub stub, @NotNull StubOutputStream dataStream) throws IOException { dataStream.writeName(stub.getName()); dataStream.writeName(stub.getTypeExpressionText()); PyVersionSpecificStubBaseKt.serializeVersions(stub.getVersions(), dataStream)...
} @Override public void indexStub(@NotNull PyTypeAliasStatementStub stub, @NotNull IndexSink sink) { String name = stub.getName(); if (name != null && PyUtil.getInitialUnderscores(name) == 0 && stub.getParentStub() instanceof PyFileStub) { sink.occurrence(PyTypeAliasNameIndex.KEY, name); }
java
2025-01-20T14:21:37
JetBrains/intellij-community
5bc798d606aa9d2ac438d050bff5497983341942
java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaErrorFormatUtil.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.errors; import com.intellij.codeInsight.JavaContainerProvider; import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; import com...
} static @Nullable TextRange getRange(@NotNull PsiElement element) { if (element instanceof PsiMember member) { return getMemberDeclarationTextRange(member); } if (element instanceof PsiNewExpression newExpression) { PsiJavaCodeReferenceElement reference = newExpression.getClassReference...
} static @NotNull @Nls String getRecordMethodKind(@NotNull PsiMethod method) { if (JavaPsiRecordUtil.isCompactConstructor(method)) { return JavaCompilationErrorBundle.message("record.compact.constructor"); } if (JavaPsiRecordUtil.isCanonicalConstructor(method)) { return JavaCompilationErrorBu...
java
2025-01-23T11:12:20
JetBrains/intellij-community
b0614fa46dfdab6c651760327cbea1ae0228c919
java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaMismatchedCallContext.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.errors; import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; import com.intellij.java.codeserver.highlighting.JavaCompilationE...
private static @NotNull HtmlChunk getTypeMismatchTable(@Nullable MethodCandidateInfo info, @NotNull PsiSubstitutor substitutor, PsiParameter @NotNull [] parameters, ...
private @NotNull HtmlChunk createOneArgMismatchTooltip(PsiExpression @NotNull [] expressions, PsiParameter @NotNull [] parameters) { PsiExpression wrongArg = mismatchedExpressions.get(0); PsiType argType = wrongArg != null ? wrongArg.getType() : null; if (argType != null) { int idx = ArrayUtil.find(ex...
java
2025-01-22T14:41:25
JetBrains/intellij-community
72a8edd9edb921909a6ffb680ddc770cb1d7c85e
platform/platform-impl/src/com/intellij/openapi/wm/impl/trialStateWidget/TrialStateUtils.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.openapi.wm.impl.trialStateWidget import com.intellij.ide.IdeBundle import com.intellij.openapi.application.ex.ApplicationManagerEx import com.intellij.openapi.ui.Messages import...
} fun openTrailStateTab() { // todo implement println("openTrailStateTab not implemented") } fun showRegister() { // todo implement println("showRegister not implemented") } }
} fun showTrialEndedDialog() { val answer = Messages.showYesNoDialog(IdeBundle.message("trial.state.trial.ended.dialog.text"), IdeBundle.message("trial.state.trial.ended.dialog.title"), IdeBundle.message("trial.state.trial.ended....
kotlin
2025-01-22T17:57:18
JetBrains/intellij-community
dfb61b0980332d6fa6ed7a110de4ed05f59d5307
java/idea-ui/src/com/intellij/ide/projectWizard/generators/AssetsNewProjectWizardStep.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.ide.projectWizard.generators import com.intellij.codeInsight.actions.ReformatCodeProcessor import com.intellij.ide.fileTemplates.FileTemplateManager import com.intellij.ide.proj...
} fun addEmptyDirectoryAsset(path: String, vararg permissions: PosixFilePermission) { addEmptyDirectoryAsset(path, permissions.toSet()) } fun addEmptyDirectoryAsset(path: String, permissions: Set<PosixFilePermission>) { addAssets(GeneratorEmptyDirectory(path, permissions)) } fun addFilesToOpen(v...
} fun addFileAsset(path: String, content: String, vararg permissions: PosixFilePermission) { addFileAsset(path, content, permissions.toSet()) } fun addFileAsset(path: String, content: String, permissions: Set<PosixFilePermission>) { addAssets(GeneratorFile(path, permissions, content)) } fun addFile...
kotlin
2025-01-15T10:28:50
JetBrains/intellij-community
dfb61b0980332d6fa6ed7a110de4ed05f59d5307
java/idea-ui/src/com/intellij/ide/starters/local/GeneratorAssets.kt
package com.intellij.ide.starters.local import com.intellij.ide.fileTemplates.FileTemplate import java.net.URL import java.nio.file.attribute.PosixFilePermission sealed class GeneratorAsset { abstract val relativePath: String abstract val permissions: Set<PosixFilePermission> }
data class GeneratorTemplateFile( override val relativePath: String, override val permissions: Set<PosixFilePermission>, val template: FileTemplate ) : GeneratorAsset() { constructor(relativePath: String, template: FileTemplate) : this(relativePath, emptySet(), template) } data class GeneratorResourceFi...
class GeneratorFile( override val relativePath: String, override val permissions: Set<PosixFilePermission>, val content: ByteArray, ) : GeneratorAsset() { constructor(relativePath: String, content: ByteArray) : this(relativePath, emptySet(), content) constructor(relativePath: String, content: String) ...
kotlin
2025-01-15T10:28:50
JetBrains/intellij-community
50c9fc087a4d82e1b9a9919bcc7ba2602d66420c
plugins/gradle/testSources/org/jetbrains/plugins/gradle/frameworkSupport/GradleSettingsScriptBuilderTestCase.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.plugins.gradle.frameworkSupport import org.gradle.util.GradleVersion import org.jetbrains.plugins.gradle.frameworkSupport.settingsScript.GradleSettingScriptBuilder import org.j...
groovyScript: String, kotlinScript: String, configure: GradleSettingScriptBuilder<*>.() -> Unit ) { assertBuildSettings(GradleVersion.current() to (groovyScript to kotlinScript), configure = configure) } }
vararg cases: Pair<GradleVersion, Pair<String, String>>, configure: GradleSettingScriptBuilder<*>.() -> Unit ) { for ((gradleVersion, expectedScripts) in cases) { val (expectedGroovyScript, expectedKotlinScript) = expectedScripts val actualGroovyScript = GradleSettingScriptBuilder.create(gradleVer...
kotlin
2025-01-17T21:34:37
JetBrains/intellij-community
31c76003a8c6c3f7cf993171a05190f5e6f1e9db
plugins/gradle/src/org/jetbrains/plugins/gradle/frameworkSupport/settingsScript/AbstractGradleSettingScriptBuilder.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.plugins.gradle.frameworkSupport.settingsScript import org.jetbrains.annotations.ApiStatus import org.jetbrains.plugins.gradle.frameworkSupport.script.AbstractScriptElementBuild...
} override fun includeBuild(name: String): Self = apply { script.call("includeBuild", name) } override fun enableFeaturePreview(featureName: String): Self = apply { script.call("enableFeaturePreview", featureName) } override fun pluginManagement(configure: ScriptTreeBuilder.() -> Unit): Self = a...
} override fun include(relativePath: Path): Self = apply { val projectName = relativePath .dropWhile { it.name == ".." } .joinToString(":") { it.name } when { relativePath.startsWith("..") && relativePath.nameCount == 2 -> { includeFlat(projectName) } relativePath.starts...
kotlin
2025-01-15T20:48:33
JetBrains/intellij-community
31c76003a8c6c3f7cf993171a05190f5e6f1e9db
plugins/gradle/src/org/jetbrains/plugins/gradle/frameworkSupport/settingsScript/GroovyDslGradleSettingScriptBuilder.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.plugins.gradle.frameworkSupport.settingsScript import org.jetbrains.annotations.ApiStatus import org.jetbrains.plugins.gradle.frameworkSupport.script.GroovyScriptBuilder import...
override fun generate(): String { return GroovyScriptBuilder().generate(generateTree()) } internal class Impl : GroovyDslGradleSettingScriptBuilder<Impl>() { override fun apply(action: Impl.() -> Unit) = applyKt(action) } }
override fun setProjectDir(name: String, relativePath: String): Self = addCode("""project('$name').projectDir = file('$relativePath')""")
kotlin
2025-01-15T20:48:33
JetBrains/intellij-community
31c76003a8c6c3f7cf993171a05190f5e6f1e9db
plugins/gradle/src/org/jetbrains/plugins/gradle/frameworkSupport/settingsScript/KotlinDslGradleSettingScriptBuilder.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.plugins.gradle.frameworkSupport.settingsScript import org.jetbrains.annotations.ApiStatus import org.jetbrains.plugins.gradle.frameworkSupport.script.KotlinScriptBuilder import...
override fun generate(): String { return KotlinScriptBuilder().generate(generateTree()) } internal class Impl : KotlinDslGradleSettingScriptBuilder<Impl>() { override fun apply(action: Impl.() -> Unit) = applyKt(action) } }
override fun setProjectDir(name: String, relativePath: String): Self = addCode("""project("$name").projectDir = file("$relativePath")""")
kotlin
2025-01-15T20:48:33
JetBrains/intellij-community
90048756479fd4ab5ffde19fdf37d31d3806fb79
platform/platform-api/src/com/intellij/util/ui/StatusText.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.util.ui; import com.intellij.openapi.util.NlsContexts; import com.intellij.ui.ClickListener; import com.intellij.ui.SimpleColoredComponent; import com.intellij.ui.SimpleTextAttr...
} public void paint(Component owner, Graphics g) { if (!isStatusVisibleInner()) { return; } if (owner == myOwner) { doPaintStatusText(g, getTextComponentBound()); } else { paintOnComponentUnderViewport(owner, g); } } private void paintOnComponentUnderViewport(Compone...
} /** * Sets the gap between the lines of text. * <p> * Affects all lines added <em>after</em> invocation of this method. * Supposed to be used like this: * <pre>{@code * emptyText.withUnscaledGapAfter(5).appendLine("Some text"); * }</pre> * Note that the value set persists until changed, so ...
java
2025-01-21T15:15:17
JetBrains/intellij-community
94f165e25757bc824afabec80a0a59134d93f30e
java/java-psi-api/src/com/intellij/psi/JavaPsiFacade.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.psi; import com.intellij.openapi.project.Project; import com.intellij.psi.search.GlobalSearchScope; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations....
* Searches the project for the package with the specified full-qualified name and returns one * if it is found. * * @return the PSI package, or {@code null} if no package with such name is found. */ public abstract @Nullable PsiPackage findPackage(@NonNls @NotNull String qualifiedName); /** * Se...
* Returns {@code true} if the specified scope contains the class with the specified fully qualified name, and {@code false} otherwise. * This method is equivalent to {@code findClass(...) != null} and {@code findClasses(...).length > 0} checks, but in big projects it * may work much faster, because it doesn't nee...
java
2025-01-22T11:38:36
JetBrains/intellij-community
94f165e25757bc824afabec80a0a59134d93f30e
java/java-psi-api/src/com/intellij/psi/PsiElementFinder.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.psi; import com.intellij.openapi.extensions.ProjectExtensionPointName; import com.intellij.openapi.project.PossiblyDumbAware; import com.intellij.openapi.util.Condition; import ...
/** * Searches the project for the package with the specified full-qualified name and returns one * if it is found. * * @param qualifiedName the full-qualified name of the package to find. * @return the PSI package, or null if no package with such name is found. * @see JavaPsiFacade#findPackage(St...
/** * Returns {@code true} if the specified scope contains the class with the specified fully qualified name satisfying the provided filter, * and {@code false} otherwise. */ public boolean hasClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope, @Nullable Predicate<PsiClass> filter) { ...
java
2025-01-22T11:38:36
JetBrains/intellij-community
821029866482328ad0f47195c92a5f09f6b90914
platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValue.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.xdebugger.frame; import com.intellij.util.ThreeState; import com.intellij.xdebugger.XDebuggerUtil; import com.intellij.xdebugger.XExpression; import com.intellij.xdebugger.evalu...
/** * Start computing source position of the value and call {@link XNavigatable#setSourcePosition(com.intellij.xdebugger.XSourcePosition)} * when computation is finished. * Note that this method is called from the Event Dispatch thread so it should return quickly. * @param navigatable navigatable */ ...
/** * Provides {@link CompletableFuture} which finishes when all XValue's methods can be used * (like {@link XValue#getModifier} or {@link XValueMarkerProvider#getMarker}) */ @ApiStatus.Internal public @NotNull CompletableFuture<Void> isReady() { return CompletableFuture.completedFuture(null); }
java
2025-01-21T19:10:28
JetBrains/intellij-community
da7cbb0b3ee41fe637363761b2510d09cecd23ab
java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaErrorFormatUtil.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.errors; import com.intellij.codeInsight.JavaContainerProvider; import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; import com...
static @NotNull String formatArgumentTypes(@NotNull PsiExpressionList list, boolean shortNames) { StringBuilder builder = new StringBuilder(); builder.append("("); PsiExpression[] args = list.getExpressions(); for (int i = 0; i < args.length; i++) { if (i > 0) builder.append(", "); Psi...
static @NotNull String formatResolvedSymbol(@NotNull JavaResolveResult result) { PsiElement element = result.getElement(); String symbolName = element == null ? null : HighlightMessageUtil.getSymbolName(element, result.getSubstitutor()); return symbolName == null ? "?" : symbolName; } static @NotNull S...
java
2025-01-22T10:46:03
JetBrains/intellij-community
79385c20a8b53eac23a16db6cabb218a4f07f23d
java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaErrorFormatUtil.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.errors; import com.intellij.codeInsight.highlighting.HighlightUsagesDescriptionLocation; import com.intellij.java.codeserver.highlighting.JavaCompil...
static @Nullable TextRange getRange(@NotNull PsiElement element) { if (element instanceof PsiMember member) { return getMemberDeclarationTextRange(member); } if (element instanceof PsiNewExpression newExpression) { PsiJavaCodeReferenceElement reference = newExpression.getClassReference(); ...
static @NotNull String formatArgumentTypes(@NotNull PsiExpressionList list, boolean shortNames) { StringBuilder builder = new StringBuilder(); builder.append("("); PsiExpression[] args = list.getExpressions(); for (int i = 0; i < args.length; i++) { if (i > 0) builder.append(", "); PsiType a...
java
2025-01-21T11:33:14
JetBrains/intellij-community
6f70146c36bc2265844b52f523f8252d45aeca58
python/src/com/jetbrains/python/sdk/PyLazySdk.kt
/* * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agre...
class PyLazySdk(name: String, private val create: NullableComputable<Sdk>) : ProjectJdkImpl(name, PythonSdkType.getInstance(), "", null) { fun create(): Sdk? = create.compute() }
@java.lang.Deprecated(forRemoval = true) @Deprecated("Migrate to `com.jetbrains.python.newProjectWizard`, it doesn't need this class", level = DeprecationLevel.WARNING)
kotlin
2025-01-22T01:24:46
JetBrains/intellij-community
7b44974cdb5683e361bfb1e96f3ea6f217821956
platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/autoimport/AutoReloadParallelTest.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.openapi.externalSystem.autoimport import com.intellij.openapi.externalSystem.autoimport.ExternalSystemModificationType.EXTERNAL import com.intellij.openapi.externalSystem.util.P...
} } } /** * The current implementation of settings files watcher cannot 100% separate cases by the file change time (before or during sync). * Decided that all files that changed in the begging of sync are changed before sync. * It means that files don't affect the auto-sync project status. ...
} } } fun `test settings file creating during sync`() { test { enableAsyncExecution() setDispatcherMergingSpan(MERING_SPAN) repeat(10 * TEST_ATTEMPTS) { attempt -> val settingsFile = projectNioPath.resolve("$attempt.file") projectAware.registerSettingsFile(settingsFile) ...
kotlin
2025-01-21T17:43:43
JetBrains/intellij-community
0a99e66741568380d3ad9e4f3c9930665b25f70c
platform/platform-api/src/com/intellij/openapi/diagnostic/IdeaLoggingEvent.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.openapi.diagnostic; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.a...
} @Override public String toString() { return "IdeaLoggingEvent[message=" + myMessage + ", throwable=" + getThrowableText() + "]"; } }
} /** Returns a (possibly empty) list of attachments marked by a user to be included in the error report. */ public @Unmodifiable @NotNull List<Attachment> getIncludedAttachments() { return myData instanceof IdeaLoggingEventData data ? data.getIncludedAttachments() : List.of();
java
2025-01-21T13:11:28
JetBrains/intellij-community
30eb8e5d2dbde8c904f18eba39c53ed8dbf58dcb
platform/core-impl/src/com/intellij/ide/plugins/ModuleGraph.kt
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. @file:Suppress("ReplacePutWithAssignment", "ReplaceGetOrSet", "ReplaceNegatedIsEmptyWithIsNotEmpty") package com.intellij.ide.plugins import com.intellij.openapi.extensions.PluginId import com.inte...
} if (module.moduleName != null && module.pluginId != PluginManagerCore.CORE_ID) { // add main as an implicit dependency for optional content modules; for required modules dependency is in the opposite way. val main = moduleMap.get(module.pluginId.idString)!! assert(main !== module) i...
if (doesDependOnPluginAlias(module, PluginId.getId("org.jetbrains.completion.full.line"))) { moduleMap.get("intellij.fullLine.core")?.let { result.add(it) } moduleMap.get("intellij.fullLine.local")?.let { result.add(it) } moduleMap.get("intellij.fullLine.core.impl")?.let { result.add(it) } ...
kotlin
2025-01-21T16:56:58
JetBrains/intellij-community
3049ff84603e4caf725d48f1d41dcd1a90660f9a
plugins/kotlin/base/analysis-api/analysis-api-utils/src/org/jetbrains/kotlin/idea/base/analysis/api/utils/KtSymbolFromIndexProvider.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.analysis.api.utils import com.intellij.openapi.extensions.impl.ExtensionPointImpl import com.intellij.openapi.progress.ProgressManager import com.intellij.open...
context(KaSession) @KaExperimentalApi fun getKotlinEnumEntriesByNameFilter( nameFilter: (Name) -> Boolean, scope: GlobalSearchScope = analysisScope, psiFilter: (KtEnumEntry) -> Boolean = { true }, ): Sequence<KaEnumEntrySymbol> = KotlinFullClassNameIndex.getAllElements<KtEnumEn...
/** * Collects [KaClassSymbol]s of objects with non-trivial base classes. * * @see KotlinSubclassObjectNameIndex */ context(KaSession) fun getKotlinSubclassObjectsByNameFilter( nameFilter: (Name) -> Boolean, scope: GlobalSearchScope = analysisScope, psiFilter: (KtObje...
kotlin
2025-01-16T14:30:05
JetBrains/intellij-community
1de49e89a24f465ab13a1a1c1e20f39617e00cc5
plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
// 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.java.decompiler.main.extern; import org.jetbrains.java.decompiler.util.InterpreterUtil; import java.util.Collections; import java.util.HashMap; import java.util.Map; public i...
Map<String, String> DEFAULTS = getDefaults(); static Map<String, String> getDefaults() { Map<String, String> defaults = new HashMap<>(); defaults.put(REMOVE_BRIDGE, "1"); defaults.put(REMOVE_SYNTHETIC, "0"); defaults.put(DECOMPILE_INNER, "1"); defaults.put(DECOMPILE_CLASS_1_4, "1"); defa...
String MAX_DIRECT_NODES_COUNT = "mdnc"; String MAX_DIRECT_NODES_COUNT_MESSAGE = "mdncm"; String MAX_DIRECT_VARIABLE_NODE_COUNT = "mdvnc"; String MAX_DIRECT_VARIABLE_NODES_COUNT_MESSAGE = "mdvncm";
java
2025-01-21T17:13:33
JetBrains/intellij-community
1de49e89a24f465ab13a1a1c1e20f39617e00cc5
plugins/java-decompiler/plugin/src/org/jetbrains/java/decompiler/IdeaDecompiler.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.java.decompiler import com.intellij.execution.filters.LineNumbersMapping import com.intellij.ide.highlighter.JavaClassFileType import com.intellij.ide.plugins.DynamicPlugins im...
val provider = MyBytecodeProvider(files) val saver = MyResultSaver() val maxSecProcessingMethod = options[IFernflowerPreferences.MAX_PROCESSING_METHOD]?.toString()?.toIntOrNull() ?: 0 val decompiler = BaseDecompiler(provider, saver, options, myLogger.value, IdeaCancellationManager(maxSecProce...
options[IFernflowerPreferences.MAX_DIRECT_NODES_COUNT_MESSAGE] = IdeaDecompilerBundle.message("max.direct.nodes.count.message") options[IFernflowerPreferences.MAX_DIRECT_NODES_COUNT] = AdvancedSettings.getInt("decompiler.max.direct.nodes.count") options[IFernflowerPreferences.MAX_DIRECT_VARIABLE_NODES_COUN...
kotlin
2025-01-21T17:13:33
JetBrains/intellij-community
1de49e89a24f465ab13a1a1c1e20f39617e00cc5
plugins/java-decompiler/plugin/test/com/intellij/java/decompiler/IdeaDecompilerTest.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.java.decompiler import com.intellij.JavaTestUtil import com.intellij.codeInsight.daemon.impl.HighlightInfo import com.intellij.codeInsight.daemon.impl.HighlightInfoType import c...
} fun testStubCompatibility() { val visitor = MyFileVisitor(psiManager) Registry.get("decompiler.dump.original.lines").withValue(true) { VfsUtilCore.visitChildrenRecursively(getTestFile("${JavaTestUtil.getJavaTestDataPath()}/psi/cls/mirror"), visitor) VfsUtilCore.visitChildrenRecursively(getTe...
assertFalse(decompiled, decompiled.contains("Limits for direct nodes are exceeded")) assertFalse(decompiled, decompiled.contains("Limits for variable nodes are exceeded")) } fun testSimpleWithNodeLimit() { val advancedSetting = "decompiler.max.direct.nodes.count" val previousCount = AdvancedSettings.ge...
kotlin
2025-01-21T17:13:33
JetBrains/intellij-community
6b1edd02d4599fd1d96ffcaf4b48070520ba610b
python/src/com/jetbrains/python/black/BlackFormatterVersionService.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.black import com.intellij.execution.process.CapturingProcessHandler import com.intellij.execution.target.TargetedCommandLineBuilder import com.intellij.execution.target....
} private var version: Version = UNKNOWN_VERSION private var configuration: BlackFormatterConfiguration init { configuration = BlackFormatterConfiguration.getBlackConfiguration(project).copy() version = getVersionFromSdkOrBinary() subscribeOnChanges() } @Synchronized private fun getVersio...
fun getVersionForExecutable(pathToExecutable: String): Version { val targetEnvRequest = LocalTargetEnvironmentRequest() val targetEnvironment = LocalTargetEnvironment(LocalTargetEnvironmentRequest()) val commandLineBuilder = TargetedCommandLineBuilder(targetEnvRequest) commandLineBuilder.setExe...
kotlin
2024-12-11T14:38:15
JetBrains/intellij-community
d864d5cc2d72a26be7ccbcd0b8649ee53f0a9e77
plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/search/AnnotatedMembersSearchTest.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.search import com.intellij.openapi.application.runReadAction import com.intellij.openapi.util.io.FileUtil import com.intellij.psi.PsiModifierListOwner import com.intell...
myFixture.configureByFile(fileName()) val fileText = FileUtil.loadFile(testDataFile, true) val directives = InTextDirectivesUtils.findListWithPrefixes(fileText, "// ANNOTATION: ") TestCase.assertFalse("Specify ANNOTATION directive in test file", directives.isEmpty()) runReadA...
val controlDirective = if (isFirPlugin) { IgnoreTests.DIRECTIVES.IGNORE_K2 } else { IgnoreTests.DIRECTIVES.IGNORE_K1 } IgnoreTests.runTestIfNotDisabledByFileDirective(testDataFile.toPath(), controlDirective) { doTestInternal(testDataFile) } } ...
kotlin
2025-01-20T07:41:36
JetBrains/intellij-community
83554120a8a07b923f39ccf5cbae3673b1440ecd
plugins/kotlin/code-insight/utils/src/org/jetbrains/kotlin/idea/codeinsight/utils/ImplicitThisUtils.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.idea.codeinsight.utils import org.jetbrains.annotations.ApiStatus import org.jetbrains.kotlin.analysis.api.KaSession import org.jetbrains.kotlin.analysis.api.components....
} context(KaSession) private fun getAssociatedClass(symbol: KaSymbol): KaClassSymbol? { // both variables and functions are callable, and only they can be referenced by "this" if (symbol !is KaCallableSymbol) return null return when (symbol) { is KaNamedFunctionSymbol, is KaPropertySymbol -> ...
} context(KaSession) @ApiStatus.Internal fun getLabelToBeReferencedByThis(symbol: KaSymbol): ExplicitReceiverInfo? { val (receiverProvidedBy, associatedTag) = when (symbol) { is KaClassSymbol -> symbol.psi to symbol.name is KaAnonymousFunctionSymbol -> { val receiverPsi = symbol.psi ...
kotlin
2025-01-20T21:44:24
JetBrains/intellij-community
288f29ca2ad153f38c346998edd6882ca8c9e11b
platform/platform-tests/testSrc/com/intellij/ui/jcef/JBCefCookieManagerTest.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.jcef; import com.intellij.openapi.util.Disposer; import com.intellij.testFramework.ApplicationRule; import com.intellij.ui.scale.TestScaleHelper; import org.cef.CefApp; impor...
CountDownLatch loadStartedLatch = new CountDownLatch(1); browser.getJBCefClient().addLoadHandler(new CefLoadHandlerAdapter() { @Override public void onLoadStart(CefBrowser browser, CefFrame frame, CefRequest.TransitionType transitionType) { System.out.println("onLoadStart"); loadSt...
CountDownLatch cefInitLatch = new CountDownLatch(1); CefApp.getInstance().onInitialization(s -> cefInitLatch.countDown()); JBCefTestHelper.await(cefInitLatch, "waiting CefApp initialization");
java
2025-01-21T09:06:08
JetBrains/intellij-community
cb47b90276da8ac0e9d51b635ee44596f42711f2
plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenEelUtil.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.idea.maven.utils import com.intellij.execution.wsl.WSLDistribution import com.intellij.execution.wsl.WslPath import com.intellij.notification.Notification import com.intellij.n...
import java.nio.file.Path import javax.swing.event.HyperlinkEvent object MavenEelUtil { @JvmStatic fun EelApi?.resolveM2Dir(): Path { val localUserHome = Path.of(SystemProperties.getUserHome()) val userHome = if (this != null && this !is LocalEelApi) fs.user.home.asNioPath() else localUserHome retur...
import org.jetbrains.idea.maven.utils.MavenUtil.CONF_DIR import org.jetbrains.idea.maven.utils.MavenUtil.DOT_M2_DIR import org.jetbrains.idea.maven.utils.MavenUtil.ENV_M2_HOME import org.jetbrains.idea.maven.utils.MavenUtil.MAVEN_NOTIFICATION_GROUP import org.jetbrains.idea.maven.utils.MavenUtil.MAVEN_REPO_LOCAL import...
kotlin
2025-01-21T06:03:54
JetBrains/intellij-community
e77c362643e63dc18a9fb6bbeea06a82d4650d71
java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaErrorFormatUtil.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.errors; import com.intellij.codeInsight.highlighting.HighlightUsagesDescriptionLocation; import com.intellij.java.codeserver.highlighting.JavaCompil...
} static @NotNull TextRange getMethodDeclarationTextRange(@NotNull PsiMethod method) { if (method instanceof SyntheticElement) return TextRange.EMPTY_RANGE; int start = stripAnnotationsFromModifierList(method.getModifierList()); int end; if (method.getBody() == null) { end = method.getTextRa...
} static @Nullable TextRange getRange(@NotNull PsiElement element) { if (element instanceof PsiMember member) { return getMemberDeclarationTextRange(member); } if (element instanceof PsiNewExpression newExpression) { PsiJavaCodeReferenceElement reference = newExpression.getClassReference(); ...
java
2025-01-20T16:15:37
JetBrains/intellij-community
e77c362643e63dc18a9fb6bbeea06a82d4650d71
java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/ErrorFixExtensionPoint.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.codeInsight.daemon.impl.analysis; import com.intellij.codeInsight.daemon.JavaErrorBundle; import com.intellij.codeInsight.daemon.impl.HighlightInfo; import com.intellij.codeInsi...
public static void registerFixes(@NotNull HighlightInfo.Builder info, @NotNull PsiElement context, @NotNull @PropertyKey(resourceBundle = JavaErrorBundle.BUNDLE) String code) { registerFixes(HighlightUtil.asConsumer(info), c...
public static void registerFixes(@NotNull Consumer<? super CommonIntentionAction> info, @NotNull PsiElement context, @NotNull @PropertyKey(resourceBundle = JavaErrorBundle.BUNDLE) String code) { List<ErrorFixExtensionPoint> fixes = getCodeToFixMa...
java
2025-01-20T16:15:37
JetBrains/intellij-community
b922a5bbfdff1a58cc28c6897b0dd99b77f34726
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/SimpleListItemStyle.kt
package org.jetbrains.jewel.ui.component.styling import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.shape.CornerSize import androidx.compose.runtime.Composable import androidx.compose.runtime.ProvidableCompositionLocal import androidx.compose.runtime.Stable import androidx.compo...
public companion object } @Stable @GenerateDataFunctions public class SimpleListItemMetrics( public val innerPadding: PaddingValues, public val outerPadding: PaddingValues, public val selectionBackgroundCornerSize: CornerSize, public val iconTextGap: Dp, ) { public companion object } public ...
@Composable public fun contentFor(state: ListItemState): State<Color> = rememberUpdatedState( when { state.isSelected && state.isActive -> contentSelectedActive state.isSelected && !state.isActive -> contentSelected state.isActive -> contentActive ...
kotlin
2025-01-15T14:19:50
JetBrains/intellij-community
faf2107e66d35fd838e79e3abdd94d782344844f
plugins/evaluation-plugin/core/src/com/intellij/cce/metric/Metric.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.cce.metric import com.intellij.cce.core.Session import com.intellij.openapi.diagnostic.Logger private val LOG: Logger = Logger.getInstance(Metric::class.java) interface Metric...
fun confidenceInterval(): Pair<Double, Double>? = null val value: Double val name: String val description: String val valueType: MetricValueType val showByDefault: Boolean val shouldComputeIntervals: Boolean get() = System.getenv("cce_compute_confidence_intervals")?.toBooleanStrictOrNull() == t...
fun evaluateWithIndividualScores(sessions: List<Session>): MetricEvaluationResult { if (!supportsIndividualScores) { LOG.warn("$name does not support individual scores; evaluateWithIndividualScores will return an empty map.") } val overallScore = evaluate(sessions) return MetricEvaluationResult( ...
kotlin
2025-01-20T20:12:34
JetBrains/intellij-community
3110c87f510bc212472b4834486ddf894fbca6c6
java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ExpressionChecker.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...
void checkMethodCall(@NotNull PsiMethodCallExpression methodCall) { PsiExpressionList list = methodCall.getArgumentList(); PsiReferenceExpression referenceToMethod = methodCall.getMethodExpression(); JavaResolveResult[] results = referenceToMethod.multiResolve(true); JavaResolveResult resolveResult ...
/** * See JLS 8.3.3. */ void checkIllegalForwardReferenceToField(@NotNull PsiReferenceExpression expression, @NotNull PsiField referencedField) { JavaPsiReferenceUtil.ForwardReferenceProblem problem = JavaPsiReferenceUtil.checkForwardReference(expression, referencedField, false); if (problem == JavaPsiR...
java
2025-01-20T10:58:53
JetBrains/intellij-community
3110c87f510bc212472b4834486ddf894fbca6c6
java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/LiteralChecker.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.codeInsight.CodeInsightUtilCore; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKinds; import com.intellij.la...
} } @SuppressWarnings("AssignmentToForLoopParameter") static @NotNull String parseUnicodeEscapes(@NotNull String text, @Nullable BiConsumer<? super Integer, ? super Integer> illegalEscapeConsumer) { // JLS 3.3 if (!text.contains("\\u")) return text; S...
} } void checkFragmentError(@NotNull PsiFragment fragment) { String text = InjectedLanguageManager.getInstance(fragment.getProject()).getUnescapedText(fragment); if (fragment.getTokenType() == JavaTokenType.TEXT_BLOCK_TEMPLATE_BEGIN) { checkTextBlockNewlineAfterOpeningQuotes(fragment, text); if...
java
2025-01-20T10:58:53
JetBrains/intellij-community
7fb8d11afc8fb14aa0e4564624ded53545f05887
plugins/evaluation-plugin/core/src/com/intellij/cce/evaluable/AiaConstants.kt
package com.intellij.cce.evaluable const val AIA_CONTEXT = "aia_context" const val AIA_USER_PROMPT = "aia_user_prompt" const val AIA_RESPONSE = "aia_response" const val AIA_ORIGINAL_CONTENT = "aia_original_content" const val AIA_FAILED_FILE_VALIDATIONS = "aia_failed_file_validations" const val AIA_HAS_SYNTAX_ERRORS = ...
const val AIA_ERASED_APIS = "erased_apis" const val AIA_HIGHLIGHT_ERRORS = "appeared_highlights" const val AIA_EXECUTION_SUCCESS_RATIO = "execution_success_ratio" const val AIA_TEST_LINE_COVERAGE = "test_line_coverage" const val AIA_TEST_BRANCH_COVERAGE = "test_branch_coverage" const val AIA_TEST_FILE_PROVIDED = "test...
const val AIA_PREDICTED_API_CALLS = "predicted_api_calls" const val AIA_GROUND_TRUTH_INTERNAL_API_CALLS = "ground_truth_internal_api_calls"
kotlin
2025-01-20T16:04:17
JetBrains/intellij-community
f811f4fe9e739329f390bcd18237a1801a050b68
platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/JavaHomeFinderBasic.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.projectRoots.impl; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.Proces...
} public @NotNull Set<String> findInJavaHome() { String javaHome = mySystemInfo.getEnvironmentVariable("JAVA_HOME"); return javaHome != null ? scanAll(mySystemInfo.getPath(javaHome), false) : Collections.emptySet(); } private @NotNull Set<String> findInPATH() { try { String pathVarString =...
} /// Detects the paths of JDKs on the machine with information about the Java version and architecture. public final @NotNull Set<KeyFMap> findExistingJdkEntries() { final var paths = findExistingJdks(); final var detector = JdkVersionDetector.getInstance(); return paths.stream().map(path -> { ...
java
2025-01-16T17:27:44
JetBrains/intellij-community
0df5f694b205c7cc02a4c8433521a13790b27bf1
plugins/evaluation-plugin/core/src/com/intellij/cce/actions/simplified/DatasetTransformer.kt
package com.intellij.cce.actions.simplified import com.intellij.cce.actions.* import com.intellij.cce.actions.simplified.SimplifiedDatasetSerializer.parseLineRange import com.intellij.cce.core.SimpleTokenProperties import com.intellij.cce.core.SymbolLocation import com.intellij.cce.core.TypeProperty import com.intelli...
interface OffsetProvider { fun getLineStartOffset(filePath: String, line: Int): Int fun getLineEndOffset(filePath: String, line: Int): Int } class DatasetTransformer(private val offsetProvider: OffsetProvider) { fun transform(simplifiedDataset: List<SimplifiedDatasetSerializer.InteractionData>): List<FileActio...
fun main(args: Array<String>) { if (args.size < 3) { error("All arguments are required: <projectPath> <simplifiedActionsPath> <actionsPath>") error("Example: command <projectPath> <simplifiedActionsPath> <actionsPath>") return } val (rootPath, inputPath, outputPath) = args val datasetContent = File...
kotlin
2025-01-17T08:39:54
JetBrains/intellij-community
7924d06b54b7123d9d01bad79397184496f14932
plugins/settings-sync/src/com/intellij/settingsSync/AbstractServerCommunicator.kt
package com.intellij.settingsSync import com.intellij.openapi.application.ApplicationNamesInfo import com.intellij.openapi.diagnostic.logger import com.intellij.openapi.util.io.FileUtil import com.intellij.util.io.delete import org.jetbrains.annotations.VisibleForTesting import java.io.IOException import java.io.Input...
@VisibleForTesting @Throws(IOException::class, SecurityException::class) protected fun currentSnapshotFilePath(): Pair<String, Boolean>? { try { val crossIdeSyncEnabled = isFileExists(CROSS_IDE_SYNC_MARKER_FILE) if (!myTemporary && crossIdeSyncEnabled != SettingsSyncLocalSettings.getInstance()....
private var myTemporary = false override fun setTemporary(isTemporary: Boolean) { myTemporary = isTemporary } /** * called when a request is successful, as an opposite to handleRemoteError */ protected open fun requestSuccessful() {} /** * Handles errors that occur during remote operations by ...
kotlin
2024-12-20T13:16:45
JetBrains/intellij-community
7924d06b54b7123d9d01bad79397184496f14932
plugins/settings-sync/src/com/intellij/settingsSync/SettingsSyncRemoteCommunicator.kt
package com.intellij.settingsSync import com.intellij.openapi.util.NlsSafe import com.intellij.settingsSync.auth.SettingsSyncAuthService import com.intellij.settingsSync.communicator.SettingsSyncUserData import com.intellij.util.concurrency.annotations.RequiresBackgroundThread import org.jetbrains.annotations.ApiStatu...
* checks the current state of the user's data in the cloud. */ @RequiresBackgroundThread fun checkServerState() : ServerState /** * Receives updates from server. Is typically called after "checkServerState()" */ @RequiresBackgroundThread fun receiveUpdates(): UpdateResult /** * Pushes the ...
* userId used within the communicator */ val userId: String /** * Indicates whether the communicator is temporary (i.e. used to check a remote state before enabling) * and shouldn't update configuration values */ fun setTemporary(isTemporary: Boolean) /**
kotlin
2024-12-20T13:16:45
JetBrains/intellij-community
7924d06b54b7123d9d01bad79397184496f14932
plugins/settings-sync/src/com/intellij/settingsSync/config/SyncCategoryHolder.kt
package com.intellij.settingsSync.config import com.intellij.openapi.components.SettingsCategory import com.intellij.openapi.components.SettingsCategory.* import com.intellij.settingsSync.SettingsSyncState import com.intellij.settingsSync.SettingsSyncBundle.message import org.jetbrains.annotations.Nls import java.util...
} internal class Category( val category: SettingsCategory, val secondaryGroup: SyncSubcategoryGroup? = null, ) { val name: @Nls String get() { return message("${categoryKey}.name") } val description: @Nls String get() { return message("${categoryKey}.descripti...
val disabledCategories: List<SettingsCategory> get() = arrayListOf<SettingsCategory>().apply { for (holder in allHolders) { if (!holder.isSynchronized) { add(holder.descriptor.category) } } } val disabledSubcategories: Map<SettingsCategory, List<String>> ...
kotlin
2024-12-20T13:16:45
JetBrains/intellij-community
7924d06b54b7123d9d01bad79397184496f14932
plugins/settings-sync/src/icons/SettingsSyncIcons.java
package icons; import com.intellij.ui.IconManager; import org.jetbrains.annotations.NotNull; import javax.swing.*; /** * NOTE THIS FILE IS AUTO-GENERATED * DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead */ public final class SettingsSyncIcons {
private static @NotNull Icon load(@NotNull String expUIPath, @NotNull String path, int cacheKey, int flags) { return IconManager.getInstance().loadRasterizedIcon(path, expUIPath, SettingsSyncIcons.class.getClassLoader(), cacheKey, flags); } /** 16x16 */ public static final @NotNull Icon Conflict = load("icon...
private static @NotNull Icon load(@NotNull String path, int cacheKey, int flags) { return IconManager.getInstance().loadRasterizedIcon(path, SettingsSyncIcons.class.getClassLoader(), cacheKey, flags); }
java
2024-12-20T13:16:45
JetBrains/intellij-community
923612fa31d8403ea1951033ae7c72b1b8058962
build/jvm-rules/src/compiler-util/JvmBuilderFlags.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.bazel.jvm.kotlin import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments import java.nio.file.Files import java.nio.file.Path import java.util.regex.Pattern pr...
kotlinArgs.noStdlib = true kotlinArgs.disableStandardScript = true kotlinArgs.apiVersion = args.optionalSingle(JvmBuilderFlags.API_VERSION) kotlinArgs.languageVersion = args.optionalSingle(JvmBuilderFlags.LANGUAGE_VERSION) // jdkRelease leads to some strange compilation failures like "cannot access class '...
// @todo check for -Xskip-prerelease-check -Xallow-unstable-dependencies during import kotlinArgs.skipPrereleaseCheck = true kotlinArgs.allowUnstableDependencies = true
kotlin
2025-01-18T19:27:26
JetBrains/intellij-community
578b7cc81cfb20474b96f6d985d2203131797e54
platform/lang-impl/testSources/com/intellij/openapi/roots/OrderEnumeratorHandlerRegistrationTest.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.openapi.roots import com.intellij.openapi.Disposable import com.intellij.openapi.application.runWriteAction import com.intellij.openapi.module.EmptyModuleType import com.intelli...
val enumerator = ModuleRootManager.getInstance(moduleA).orderEntries().recursively().roots(OrderRootType.SOURCES).usingCache() assertEquals(moduleBTestSources, assertOneElement(enumerator.roots)) } private fun runWithRegisteredExtension(factory: OrderEnumerationHandler.Factory, action: () -> Unit) { ...
// non-recursive runWithRegisteredExtension(MockOrderEnumerationHandlerFactory(includeTestsFromDependentModulesToTestClasspath = false)) { val enumerator = ModuleRootManager.getInstance(moduleA).orderEntries().roots(OrderRootType.SOURCES).usingCache() assertEmpty(enumerator.roots) }
kotlin
2025-01-15T23:18:38
JetBrains/intellij-community
02b49e0a0ddd5b9b3c15031756f47ea935b3ed39
java/java-tests/testData/ig/com/siyeh/igtest/migration/try_finally_can_be_try_with_resources/TryFinallyCanBeTryWithResources.java
package com.siyeh.igtest.migration.try_finally_can_be_try_with_resources; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.BufferedInputStream; import java.io.*; class TryFinallyCanBeTryWithResources { public void read1() throws IOException { final InputStr...
private MyAutoCloseable getDelegate(MyAutoCloseable orig) { MyAutoCloseable result = null; MyAutoCloseable another = create(); try { result = new MyAutoCloseable() { @Override public void close() { try { orig.close(); } finally { another....
private void twoVariablesWithAnonymousClass() throws Exception { MyAutoCloseable closeable1 = create(); MyAutoCloseable closeable = new MyAutoCloseable() { @Override public void close() { MyAutoCloseable closeable2 = create(); try { System.out.println(1); } finally...
java
2025-01-18T09:31:43
JetBrains/intellij-community
c42458052370a0f4b67cf02a219294e2ff7d72bc
build/jvm-rules/src/jps-builder/packager/packager.kt
@file:Suppress("UnstableApiUsage") package org.jetbrains.bazel.jvm.jps import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.jetbrains.bazel.jvm.abi.writeAbi import org.jetbrains.intellij.build.io.* import jav...
} suspend fun packageToJar( outJar: Path, abiJar: Path?, sourceDescriptors: Array<SourceDescriptor>, classOutDir: Path, log: RequestLog ) { if (abiJar == null) { withContext(Dispatchers.IO) { createJar( outJar = outJar, sourceDescriptors = sourceDescriptors, classOutDir =...
override fun equals(other: Any?): Boolean { if (this === other) return true if (other !is SourceDescriptor) return false if (sourceFile != other.sourceFile) return false if (!digest.contentEquals(other.digest)) return false if (outputs != other.outputs) return false return true } override...
kotlin
2025-01-17T10:26:12
JetBrains/intellij-community
1935f2ea906b1a936b47868518bf0c918b61a022
python/helpers/pydev/_pydevd_bundle/tables/pydevd_numpy.py
# Copyright 2000-2023 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 TABLE_TYPE_NEXT_VALUE_SEPARATOR = '__pydev_table_column_type_val__' MAX_COLWIDTH = 100000 ONE_DIM, TWO_DIM, WITH_TYPES = range(3) NP_ROWS_TYPE = "int64" ...
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): col_type = self.array.dtype if len(col_type) != 0: return WITH_TY...
def get_bytes(arr): # type: (np.ndarray) -> str try: from PIL import Image if not (np.issubdtype(arr.dtype, np.floating) or np.issubdtype(arr.dtype, np.integer)): raise ValueError("Error: Only numeric array types are supported.") if arr.ndim == 1: arr = np.expan...
python
2025-01-18T01:37:10
JetBrains/intellij-community
c65dfa444b26968579c1aef97ea9d95aa952ae77
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("ParameterName2.kt") public void testParameterName2() throws Exception { runTest("../../completion/testData/basic/fullJdk/lambdaSignature/ParameterName2.kt"); } @TestMetadata("ParameterName20.kt") public void testParameterName20() throws Exception { ...
@TestMetadata("ParameterName14.kt") public void testParameterName14() throws Exception { runTest("../../completion/testData/basic/fullJdk/lambdaSignature/ParameterName14.kt"); } @TestMetadata("ParameterName15.kt") public void testParameterName15() throws Exception { ...
java
2025-01-14T12:57:58
JetBrains/intellij-community
47d95ae0898aec2db88f7d08c007a727a6da2302
plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/tree/MavenProjectImportContextProvider.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.importing.tree import com.intellij.openapi.project.Project import com.intellij.openapi.roots.DependencyScope import com.intellij.openapi.util.registry.Registry.Compa...
} private data class LanguageLevels( val sourceLevel: LanguageLevel?, val testSourceLevel: LanguageLevel?, val targetLevel: LanguageLevel?, val testTargetLevel: LanguageLevel?, ) { fun mainAndTestLevelsDiffer(): Boolean { return (testSourceLevel != null && testSourceLevel != sourceLeve...
} private fun getDependencies(context: ModuleImportDataContext, importData: MavenProjectImportData): MavenModuleImportDataWithDependencies { val mavenProject = importData.mavenProject MavenLog.LOG.debug("Creating dependencies for $mavenProject: ${mavenProject.dependencies.size}") val mainDependencies: ...
kotlin
2025-01-17T21:24:26
JetBrains/intellij-community
1cf356974703d80a3697529cb1bb87c2778ce809
platform/eel/src/com/intellij/platform/eel/EelDescriptor.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.eel import com.intellij.platform.eel.path.EelPath /** * A descriptor of an environment where [EelApi] may exist. * * ## Examples * 1. There is a singleton [LocalEe...
* You are free to compare and store [EelDescriptor]. * TODO: In the future, [EelDescriptor] may also be serializable. * If you need to access the remote environment, you can use the method [upgrade], which can suspend for some time before returning a working instance of [EelApi] */ interface EelDescriptor { /**...
* The intended way to obtain [EelDescriptor] is with the use of `getEelDescriptor`: * ```kotlin * Path.of("\\\\wsl.localhost\\Ubuntu\\home\\Jacob\\projects").getEelDescriptor() * project.getEelDescriptor() * ``` *
kotlin
2025-01-16T14:50:13
JetBrains/intellij-community
e31161a5d826b2f9b08dece304aad705a2ed4286
platform/eel-provider/src/com/intellij/platform/eel/provider/EelProvider.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("EelProviderUtil") package com.intellij.platform.eel.provider import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.service import com.inte...
val localEel: LocalEelApi by lazy { if (SystemInfo.isWindows) ApplicationManager.getApplication().service<LocalWindowsEelApi>() else ApplicationManager.getApplication().service<LocalPosixEelApi>() } data object LocalEelDescriptor : EelDescriptor { override val operatingSystem: EelPath.OS get() = if (SystemIn...
/** * Retrieves [EelDescriptor] for the environment where [this] is located. * @throws IllegalArgumentException if the project is [Project.isDefault] */ @Throws(IllegalArgumentException::class) fun Project.getEelDescriptor(): EelDescriptor { val filePath = projectFilePath if (filePath == null) { throw Illega...
kotlin
2025-01-16T14:23:01
JetBrains/intellij-community
5389b3f44846b50a1de7776b9960672314425fef
plugins/kotlin/idea/tests/testData/codeInsight/hints/arguments/namedParameters.k2.kt
fun foo(index: Int, firstName: String = "John", lastName: String = "Smith") {} fun simpleFun1(name: String){} fun simpleFun2(name: String){} fun simpleFun2(name: String, value: Int){} val f = foo(/*<# [namedParameters.kt:8]index| = #>*/0, lastName = "Johnson") val f2 = foo(/*<# [namedParameters.kt:8]index| = #>*/0, fi...
fun m() { val myName = "name" val name = "name" val n = "name" simpleFun0() simpleFun1(/*<# [namedParameters.kt:94]name| = #>*/"name") simpleFun1(name) simpleFun1(/*<# [namedParameters.kt:94]name| = #>*/n) simpleFun2(name) simpleFun2(myName) simpleFun2(/*<# [namedParameters.kt:1...
fun fVararg(vararg v: String) = fVararg(/*<# …|[namedParameters.kt:280]v| = #>*/*v)
kotlin
2025-01-17T15:15:11
JetBrains/intellij-community
92475dcc866450c6fe416e3b0ceda7fdf3afdb86
plugins/gradle/java/src/toml/util.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.plugins.gradle.toml import com.intellij.openapi.components.service import com.intellij.openapi.module.ModuleUtilCore import com.intellij.openapi.roots.ProjectFileIndex import c...
private fun getVersionCatalogName(psiClass: PsiClass): String? { val name = psiClass.name?.substringAfter(LIBRARIES_FOR_PREFIX) ?: return null if (name.endsWith("InPluginsBlock")) return name.substringBefore("InPluginsBlock") else return name } private class TomlVersionCatalogVisitor(containingClasses:...
/** * Determines a section name (libraries / plugins / bundles / versions) the given key-value belongs to */ fun getTomlParentSectionName(tomlKeyValue: TomlKeyValue): String? { val parentTable = tomlKeyValue.parent?.asSafely<TomlTable>() ?: return null return parentTable.header.key?.name }
kotlin
2025-01-16T14:36:55
JetBrains/intellij-community
5e380ec4c7792a73e526d51ae482226186eab386
java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/JavaErrorVisitor.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.JavaCompilationError; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKind...
} @Override public void visitAnnotation(@NotNull PsiAnnotation annotation) { super.visitAnnotation(annotation); if (!hasErrorResults()) checkFeature(annotation, JavaFeature.ANNOTATIONS); myAnnotationChecker.checkAnnotation(annotation); } @Override public void visitPackageStatement(@NotNull ...
} @Override public void visitRecordComponent(@NotNull PsiRecordComponent recordComponent) { super.visitRecordComponent(recordComponent); if (!hasErrorResults()) myRecordChecker.checkRecordComponentWellFormed(recordComponent); if (!hasErrorResults()) myRecordChecker.checkRecordAccessorReturnType(recordC...
java
2025-01-16T13:33:43
JetBrains/intellij-community
d3a0bbc293610c27a7a2e09196f52f36272ed3e9
plugins/kotlin/onboarding-gradle/src/org/jetbrains/kotlin/onboarding/gradle/BuildProcessSatisfactionSurveyStore.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.onboarding.gradle import com.intellij.openapi.components.* import com.intellij.openapi.project.Project import com.intellij.openapi.project.modules import org.jetbrains.a...
} internal fun shouldShowDialog(): Boolean { val state = currentState if (state.userSawSurvey || state.firstKotlinGradleBuildTime == 0L || state.daysWithGradleBuilds < MINIMUM_BUILDS_BEFORE_SURVEY) return false return Duration.between( Instant.ofEpochSecond(state.firstKotli...
if (currentState.firstGradleBuildTime == 0L) { currentState.firstGradleBuildTime = currentTime.epochSecond } } /** * Returns the date on which the user was first detected to have used Kotlin and Gradle. * Returns null if an error occurred, or the user has not used it before. ...
kotlin
2025-01-17T09:40:45
JetBrains/intellij-community
d3a0bbc293610c27a7a2e09196f52f36272ed3e9
plugins/kotlin/onboarding-gradle/test/org/jetbrains/kotlin/onboarding/gradle/BuildProcessSatisfactionSurveyStoreTest.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.onboarding.gradle import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase import org.jetbrains.kotlin.onboarding.gradle.BuildProcessSatisfactionSu...
} fun testRecordDialogShown() { val instance = createInstance() instance.recordSurveyShown() assertTrue(instance.currentState.userSawSurvey) } fun testShouldShowIfEverythingIsFulfilled() { assertTrue(createStateThatShouldShow().shouldShowDialog()) } fun testFi...
} fun testCorrectRecordGradleBuildBehavior() { val instance = createInstance() assertEquals(0L, instance.currentState.firstKotlinGradleBuildTime) assertEquals(0L, instance.currentState.firstGradleBuildTime) instance.recordNonKotlinBuild() assertEquals(0L, instance.currentSta...
kotlin
2025-01-17T09:40:45
JetBrains/intellij-community
d356b960c2acc5e8b1136f36fd98511b2dccced8
plugins/journey/src/org/jetbrains/intellij/plugins/journey/diagram/JourneyDiagramLayout.java
package org.jetbrains.intellij.plugins.journey.diagram; import com.intellij.diagram.DiagramBuilder; import com.intellij.openapi.graph.base.Edge; import com.intellij.openapi.graph.base.Node; import com.intellij.openapi.graph.builder.GraphBuilder; import com.intellij.openapi.graph.services.GraphLayoutService; import com...
} public static void addEdgeElementLayout(DiagramBuilder builder, JourneyNode fromJourneyNode, JourneyNode toJourneyNode, boolean isLeftToRight) { var edgesToLayout = List.of(builder.getGraphBuilder().getGraph().getEdgeArray()); List<Node> nodesToLayout = new ArrayList<>(); var fromNode = getRea...
} public static Optional<EdgeRealizer> getRealizer(DiagramBuilder builder, JourneyEdge journeyEdge) { Graph2D graph2D = builder.getGraphBuilder().getGraph(); Optional<Edge> edge = Arrays.stream(graph2D.getEdgeArray()).filter( (e) -> Objects.equals(builder.getEdgeObject(e), journeyEdge)).findFirst(); ...
java
2024-12-06T10:55:24
JetBrains/intellij-community
1c5736c31aa1e0ea16ddfc6c16ce0cdfe2a454bc
plugins/journey/src/org/jetbrains/intellij/plugins/journey/editor/JourneyEditorManager.java
// 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.intellij.plugins.journey.editor; import com.intellij.codeInsight.documentation.render.DocRenderManager; import com.intellij.openapi.Disposable; import com.intellij.openapi.appl...
public Editor openEditor(PsiMember psiElement) { PsiFile psiFile = ReadAction.nonBlocking(() -> psiElement.getContainingFile()).executeSynchronously(); if (psiFile == null) { return null; } Editor editor = createEditor(psiFile.getProject(), psiFile.getFileDocument(), ...
private static Editor createEditor(Project project, Document document, @NotNull VirtualFile file) { EditorImpl editor = (EditorImpl)EditorFactory.getInstance().createEditor(document, project, file, false); JScrollPane scrollPane = editor.getScrollPane(); editor.setBorder(JBUI.Borders.empty()); editor.ge...
java
2024-12-02T20:57:07
JetBrains/intellij-community
9bbe5c7e211e91aef17408bcd89c8482451c2f75
plugins/journey/test/org/jetbrains/intellij/plugins/journey/diagram/JourneyDiagramDataModelTest.java
package org.jetbrains.intellij.plugins.journey.diagram; import com.intellij.diagram.DiagramBuilder; import com.intellij.diagram.DiagramDataKeys; import com.intellij.diagram.DiagramEdge; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.project.Project; import com.intellij.psi.JavaPsiFacad...
} private static PsiMethod createPsiMethod(Project project, String method) { PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project); String methodText = "public void " + method + "() {}"; return ReadAction.compute(() -> { return elementFactory.createMethodFromText(methodText...
} /** * [A] -> [B] -> [C] * delete(B) * [A] -> [C] */ @Test void testDeleteTransitNode() { JourneyDiagramDataModel model = myDataModel; JourneyNode nodeA = model.addElement(new JourneyNodeIdentity(createPsiMethod(myProject, "a"))); assertNotNull(nodeA); JourneyNode nodeB = model.addEl...
java
2024-11-28T14:01:12
JetBrains/intellij-community
84dff0ee8df3b6cb3c2aa6f71f72bb871796abab
plugins/journey/src/org/jetbrains/intellij/plugins/journey/actions/StartJourneyIntentionAction.kt
package org.jetbrains.intellij.plugins.journey.actions import com.intellij.codeInsight.intention.IntentionAction import com.intellij.codeInsight.intention.LowPriorityAction import com.intellij.icons.AllIcons import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.opena...
return true } override fun invoke(project: Project, editor: Editor?, file: PsiFile?) { JourneyShowDiagram().showDiagram(requireNotNull(JourneyNavigationUtil.getPsiElement(editor, file))) } override fun getIcon(flags: Int) = AllIcons.FileTypes.Diagram }
if (editor == null || file == null) { return false } // do not suggest create journey if we are already in journey if (editor.getUserData(JourneyDataKeys.JOURNEY_DIAGRAM_DATA_MODEL) != null) { return false }
kotlin
2024-11-27T22:34:39
JetBrains/intellij-community
84dff0ee8df3b6cb3c2aa6f71f72bb871796abab
plugins/journey/src/org/jetbrains/intellij/plugins/journey/diagram/JourneyDiagramProvider.java
package org.jetbrains.intellij.plugins.journey.diagram;// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. import com.intellij.diagram.*; import com.intellij.diagram.extras.DiagramExtras; import com.intellij.openapi.application.ReadAction; import com...
private final DiagramElementManager<JourneyNodeIdentity> myElementManager; private final JourneyDiagramVfsResolver myVfsResolver = new JourneyDiagramVfsResolver(); private final JourneyDiagramExtras myExtras = new JourneyDiagramExtras(); public JourneyDiagramProvider() { myElementManager = new JourneyDia...
/** For some reason {@link com.intellij.uml.UmlEditorProvider} (private method #getProviderFromFile) COPIES provider via ctor, so models become diverged. Therefore they are static for now. TODO Make them non-static when Journey uses custom EditorProvider */ private static final List<JourneyDiagramDataMo...
java
2024-11-27T22:34:39
JetBrains/intellij-community
995161d73eb436806d7ac6f71f4fb9a078b63e64
platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeMouseEventDispatcher.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.keymap.impl; import com.intellij.featureStatistics.FeatureUsageTracker; import com.intellij.ide.DataManager; import com.intellij.ide.IdeEventQueue; import com.intellij.o...
if (c instanceof IdeGlassPaneImpl) { c = ((IdeGlassPaneImpl)c).getTargetComponentFor(e); } if (c == null) { // do nothing if component doesn't contains specified point return false; } if (c instanceof MouseShortcutPanel || c.getParent() instanceof MouseShortcutPanel) { return f...
if (c != null && c.getParent() instanceof JComponent view && isDiagramViewComponent(view)) { // FIXME rewrite comment // We cannot add a new dependency on Graph2D, so there is no way to fetch Graph2DCanvas itself, so we have use heck for Autoscroll for (Component graph2DComponent : view.getComponents(...
java
2024-11-23T16:32:04
JetBrains/intellij-community
995161d73eb436806d7ac6f71f4fb9a078b63e64
plugins/journey/src/org/jetbrains/intellij/plugins/journey/diagram/ui/JourneyTitleBar.java
package org.jetbrains.intellij.plugins.journey.diagram.ui; import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.util.NlsContexts; import com.intellij.ui.components.JBLabel; import com.intellij.ui.components.JBPanel; impor...
DefaultActionGroup actionGroup = new DefaultActionGroup(); var icons = Arrays.asList(AllIcons.General.HideToolWindow, AllIcons.General.ExpandComponent, AllIcons.General.Close); for (int i = 0; i < icons.size(); i++) { int finalI = i; actionGroup.addAction(new AnAction() { @Override ...
JBLabel titleLabel = new JBLabel(title); titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 0)); titleLabel.setOpaque(true); titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD)); add(titleLabel, BorderLayout.CENTER); ActionToolbar actionToolbar = initActionToolbar(runnables); ...
java
2024-11-23T16:32:04
JetBrains/intellij-community
15f96590394a94afb3bb7c3dd7a595af4264848d
plugins/journey/src/org/jetbrains/intellij/plugins/journey/diagram/JourneyDiagramElementManager.java
package org.jetbrains.intellij.plugins.journey.diagram; import com.intellij.diagram.DiagramBuilder; import com.intellij.diagram.DiagramElementManager; import com.intellij.diagram.DiagramProvider; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.ui.SimpleColoredText; import com.intellij.util.Ar...
@Override public boolean canCollapse(JourneyNodeIdentity element) { return false; } @Override public boolean isContainerFor(JourneyNodeIdentity container, JourneyNodeIdentity element) { return false; } @Override public @Nullable @Nls String getElementTitle(JourneyNodeIdentity element) { ...
// Override to prevent stackoverflow error. @Override public @Nullable SimpleColoredText getItemType(@Nullable JourneyNodeIdentity nodeElement, @Nullable Object nodeItem, @Nullable DiagramBuilder builder) { return ...
java
2024-11-18T14:27:33
JetBrains/intellij-community
15f96590394a94afb3bb7c3dd7a595af4264848d
plugins/journey/src/org/jetbrains/intellij/plugins/journey/editor/JourneyEditorFactory.java
package org.jetbrains.intellij.plugins.journey.editor; import com.intellij.codeInsight.documentation.render.DocRenderManager; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.editor.impl.EditorImpl; imp...
return editor; } public static @Nullable Editor stealEditor(PsiElement psiElement) { VirtualFile virtualFile = psiElement.getContainingFile().getViewProvider().getVirtualFile(); Project project = psiElement.getProject(); OpenFileDescriptor descriptor = new OpenFileDescriptor(project, virtualFile, ...
/* Rendered docs cannot be resized along with font size, which leads to a small code text and giant Javadocs. Can turn it back when rendered docs support font size change. */ DocRenderManager.setDocRenderingEnabled(editor, false);
java
2024-11-18T14:27:33
JetBrains/intellij-community
1528365a93b24ef4bf3da2e4dfcf7407ec5df034
plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/StandardMavenModuleType.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.idea.maven.importing import org.jetbrains.annotations.ApiStatus.Internal sealed interface MavenModuleType { /** * Module contains main, test or both folders and dependenc...
* Module containing only test folders and dependencies */ TEST_ONLY(containsCode = true, containsMain = false, containsTest = true) }
* Additional module containing only main folders and dependencies (e.g., from `compileSourceRoots` tag * in compiler plugin execution configuration) */ MAIN_ONLY_ADDITIONAL(containsCode = true, containsMain = true, containsTest = false), /**
kotlin
2025-01-16T21:42:40
JetBrains/intellij-community
cf3b428fe6882a48b2d8ecde241b498c07749d4b
plugins/kotlin/code-insight/kotlin.code-insight.k2/test/org/jetbrains/kotlin/idea/k2/hints/KtParameterHintsProviderTestGenerated.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.hints; import com.intellij.testFramework.TestDataPath; import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode; import org.jetbrains.kotlin.idea.base.test...
@TestMetadata("namedParameters.kt") public void testNamedParameters() throws Exception { runTest("../../idea/tests/testData/codeInsight/hints/arguments/namedParameters.kt"); } @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("../../idea/tests/testData...
@TestMetadata("libraryElement.kt") public void testLibraryElement() throws Exception { runTest("../../idea/tests/testData/codeInsight/hints/arguments/libraryElement.kt"); }
java
2025-01-16T20:01:15
JetBrains/intellij-community
cf3b428fe6882a48b2d8ecde241b498c07749d4b
plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/codeInsight/hints/KotlinArgumentsHintsProviderTestGenerated.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.codeInsight.hints; import com.intellij.testFramework.TestDataPath; import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode; import org.jetbrains.kotlin.idea....
@TestMetadata("namedParameters.kt") public void testNamedParameters() throws Exception { runTest("testData/codeInsight/hints/arguments/namedParameters.kt"); } @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("testData/codeInsight/hints/arguments/simpl...
@TestMetadata("libraryElement.kt") public void testLibraryElement() throws Exception { runTest("testData/codeInsight/hints/arguments/libraryElement.kt"); }
java
2025-01-16T20:01:15