Commit Graph

954 Commits

Author SHA1 Message Date
Sergey Rostov fd16078a34 gradle.kts: add clearCaches method for testing 2019-12-16 10:31:11 +03:00
Sergey Rostov 559b067f91 gradle.kts: move areSimilar to utils.kt to use in tests 2019-12-16 10:31:11 +03:00
Ilya Chernikov b8034567ef Change script definition lookup key from File to ScriptSource
to make it more generic and allow easier implementation fo the
non-file based scripts.
2019-12-02 16:46:54 +01:00
Anton Yalyshev 1bbd17c4d6 Turn off FUS data sending in 1.3.61+ as we as we sent enough in 1.3.60 2019-11-27 18:42:42 +03:00
Anton Yalyshev ffa0896592 Minor correction of attributes naming 2019-11-27 16:59:27 +03:00
Anton Yalyshev c57c9b2e63 Prepare data for successful FUS Whitelist parsing 2019-11-27 16:59:27 +03:00
Natalia Selezneva c9cb4dff52 Scripting: introduce ide-specific comparision of script compilation configurations (KT-34626)
Do not take into account fields that doesn't affect IDE
Also it will threat configurations from old and new scripting API as similar
FIt will make sense for script dependencies loaded using Gradle TAPI (new Scripting API) and Old Scripting API
^KT-34626
2019-11-27 11:08:45 +03:00
Natalia Selezneva 72e99b5863 Scripting: avoid just in case configuration requests to Gradle (KT-34442)
Listen to changes in files that may affect gradle configuration
Remove configuration request if none of such file was changed since last request
^KT-34442 Fixed
2019-11-27 11:08:44 +03:00
Dmitriy Dolovov 58dd9a6004 Fix AWT freeze in KotlinNativeABICompatibilityChecker (part 2)
Issue #KT-35052
2019-11-25 09:07:09 +07:00
Sergey Rostov 75a23b4bc4 Minor: changes after review 2019-11-22 11:43:35 +03:00
Sergey Rostov fc100d13dd Scripting: move gradle specific logic to idea-gradle 2019-11-22 11:43:34 +03:00
Sergey Rostov 0fb58ed94c Scripting loading tests and extension points 2019-11-22 11:43:34 +03:00
Natalia Selezneva ca71b2fe90 Add script configuration dependencies to script classpath
It was missing during configuration refinement thought new scripting API and during loading script configuration on Gradle project import

Do not pass additional classpath to configuration classpath: this may only affects Gradle with New scripting API (because it isn't used from other places)
In additional classpath kotlin-compiler and kotlin-stdlib was passed and there is no needs for this during loading Script Definitions through new scripting API

^KT-34626 Fixed
2019-11-22 11:43:34 +03:00
Sergey Rostov c905bbca36 Scripting: invalidate caches on roots changes 2019-11-14 14:01:30 +03:00
Sergey Rostov b757224df1 Scripting: invalidate caches on roots changes 2019-11-14 09:50:03 +03:00
Sergey Rostov df0c250fd8 Scripting: fix lost caches clearing call 2019-11-14 09:50:03 +03:00
Sergey Rostov 542f21b701 Scripting, minor: cache firstScriptSdk 2019-11-14 09:50:03 +03:00
Sergey Rostov b4185c9d47 ScriptClassRootsCache: load configuration if it is not cached 2019-11-13 12:39:02 +03:00
Sergey Rostov a84e948051 Scripting: pass KtFile to ScriptConfigurationLoader 2019-11-13 12:39:02 +03:00
Natalia Selezneva 42cb53a380 Always apply new script configuration in tests 2019-11-11 15:15:17 +03:00
Sergey Rostov 698d675efe Scripting: fix saving to file attributes 2019-11-11 15:15:17 +03:00
Sergey Rostov 05e8acffa7 Scripting: restore reports for applied configuration in case of previous error 2019-11-11 15:15:17 +03:00
Sergey Rostov 96b4ceb067 scripting: skip loading when reverting to applied configuration 2019-11-11 15:15:17 +03:00
Sergey Rostov 2499c42ac4 scripting: PsiModificationStamp add virtual file modification stamp 2019-11-11 15:15:17 +03:00
Sergey Rostov 789ad23e8d Minor: isScriptDependenciesUpdaterDisabled -> isScriptChangesNotifierDisabled 2019-11-11 15:15:17 +03:00
Sergey Rostov 61b17de625 Minor: change ScriptConfigurationCache.kt declarations order for better readability, more docs 2019-11-11 15:15:16 +03:00
Sergey Rostov fbb2b260dd Split script configuration state into applied and loaded to make markUpToDate more clear 2019-11-11 15:15:16 +03:00
Natalia Selezneva fde1d3fdf7 Wrap exceptions from external script configuration loader with error handling 2019-11-11 15:15:16 +03:00
Sergey Rostov e2928550ca Fix retrieving virtual file 2019-11-11 15:15:16 +03:00
Sergey Rostov 9105e38041 Mark not applied configuration as up-to-date, simplify concurrency handling 2019-11-11 15:15:16 +03:00
Sergey Rostov 0422abdb7b LoadedScriptConfiguration and CachedConfigurationSnapshot are merged to ScriptConfigurationSnapshot 2019-11-11 15:15:15 +03:00
Sergey Rostov a89ce4c590 BackgroundExecutor: cancel all tasks on user cancel, remove useless updateProgress call 2019-11-11 15:15:15 +03:00
Sergey Rostov 19d35d7f27 Implement Gradle specific behavior for script configuration update logic
We have plans to extract separate implementation for Gradle scripts, but it
would be better to support something at this point.
For now, we have custom listener, loader and up-to-date check for default configuration manager:
- listener will do forced reload on editor activation, even it is already up-to-date
this is required for Gradle scripts, since it's classpath may depend on other files (`.properties` for example)
- loader will force save failures before running loader. also it will skip loading if
`kotlin.gradle.scripts.useIdeaProjectImport` registry key is enabled
- loader will return inputs with overridden up-to-date checks: file will be considered
out-of-date only when `buildscript` or `plugins` blocks are changed
2019-11-11 15:15:15 +03:00
Sergey Rostov 9d2cc484aa ide, scripting: rework script configuration caching, introduce persistent fs cache
## Simplify ScriptConfigurationManager mental model
Everything related to cache managing moved to `org.jetbrains.kotlin.idea.core.script.configuration`.
DefaultScriptConfigurationManager slitted into:
- `AbstractScriptConfigurationManager`
- `DefaultScriptConfigurationManager`
- `ScriptClassRootsCache`
The main idea is to simplify the mental model of ScriptConfigurationManager.
Concrete implementation should provide just two things:
- `createCache(): ScriptConfigurationCache` that should return cache implementation with `get` and `set` methods
- `reloadOutOfDateConfiguration(...)` will be called on [cache] miss or when [file] is changed.

Implementation should initiate loading of [file]'s script configuration and call [saveChangedConfiguration]
immediately or in some future (e.g. after user will click "apply context" or/and configuration will be
calculated by some background thread).
Everything around it is implemented in `AbstractScriptConfigurationManager`.

`ScriptClassRootsCache` is extracted from `DefaultScriptConfigurationManager`:
this simplifies `AbstractScriptConfigurationManager`
Also it simplifies ScriptClassRootsCache reset: we can just drop old `ScriptClassRootsCache`
and create new one instead of resetting all internals of `ScriptClassRootsCache`.
Please see KDoc of these classes for more details:
- AbstractScriptConfigurationManager
- DefaultScriptConfigurationManager
- ScriptClassRootsCache

## Cache and up-to-date checks
Writer should put related inputs snapshot for loaded configuration.
This allows reader make up-to-date check for existed entry to avoid starting loading
process for same inputs.
Cache entry may be marked out-of-date.
Also it can be marked up-to-date, but it means that we have up-to-date loaded configuration,
ScriptConfigurationSnapshot.configuration will still contain old applied configuration.
todo: make it more clear by splitting cache entry into loaded and applied configuration with
it's own inputs.

## Loaders
Previously both sync and background loaders may be started for same files - this was useful, but not
required anymore and at the same time greatly complicates the model. So, it was dropped
and now exactly one loader should work for given file (first applicable loader will be called).
Also `ScriptConfigurationLoadingContext` is introduced to limit access to the `ScriptConfigurationManager`
internals.

## Listeners and updating configuration
This things is introduces:
- `ScriptChangesNotifier`
- `ScriptChangeListener`
- `ScriptConfigurationUpdater`
`ScriptChangesNotifier` will call first applicable `ScriptChangeListener` when editor is activated or document changed.
(it treated as applicable if [editorActivated] or [documentChanged] will return true).
Listener may call [ScriptConfigurationUpdater] to invalidate configuration and schedule reloading.
Plugins may override default listening logic by adding it's oven `ScriptChangeListener`.
`ScriptConfigurationUpdater` was extracted from `ScriptConfigurationManagerImpl`.

## Fixed issues and implement persistent FS cache
- Script configuration was not reloaded if query for same file already in progress or ready but not yet applied
- Don't start async loaders for outsider files
- Unused imports: don't start loading script configuration if the result will be not applied automatically
- Fix cases when virtual file can be null

See `DefaultScriptConfigurationManager.reloadOutOfDateConfiguration` KDoc for more details on
dealing with concurrent operations.

## Background executor and progress indicator
This things changed and fixed:
- progress displayed not only when we have more then 3 loading tasks, but also
after 1sec of loading (including case with 1 loading task for example)
- current file is displayed under the progress bar
- progress indication added: it works similar to indexing indicator. When
progress bar is displayed, max is fixed. When all work done for this max,
progress will be started from zero and new max is fixed, and so on
- cancel will drop all loading operation, not just current
- concurrency issues fixed: EA-5244265 and other related to switching between silent and
under progress worker
See `BackgroundExecutor` for more details.

## Gradle specific behavior
We have plans to extract separate implementation for Gradle scripts, but it
would be better to support something at this point.
For now, we have custom listener, loader and up-to-date check for default configuration manager:
- listener will do forced reload on editor activation, even it is already up-to-date
this is required for Gradle scripts, since it's classpath may depend on other files (`.properties` for example)
- loader will force save fails before running loader. also it will skip loading if
`kotlin.gradle.scripts.useIdeaProjectImport` registry key is enabled
- loader will return inputs with overridden up-to-date checks: file will be considered
out-of-date only when `buildscript` or `plugins` blocks are changed
2019-11-11 15:15:15 +03:00
Natalia Selezneva 915c9c367c Minor: rename script related classes 2019-11-11 15:15:15 +03:00
Natalia Selezneva 33475f30bc Minor: move files 2019-11-11 15:15:15 +03:00
Vadim Brilyantov ba77e5eba8 #KT-29622: Fix bunches for 191 and earlier idea versions 2019-11-09 16:44:12 +03:00
Vadim Brilyantov 66eeeb4705 Add Focus Mode support to kotlin language 2019-11-09 16:44:10 +03:00
Roman Golyshev da4097f488 KT-29926: Support completion of suspend lambda parameters in the body
- `suspendLambdaSignature` directory is just a copy of `lambdaSignature`
2019-11-08 19:24:05 +03:00
Leonid Startsev 7fada51c42 Add quickfix for setting explicit public visibility for diagnostic reported in API mode 2019-11-06 19:53:59 +03:00
Alexander Podkhalyuzin d2ae39489f SmartPointers in Smart Completion for anonymous object generation
#KT-32615 Fixed
2019-11-05 17:51:34 +03:00
Anton Yalyshev e146d308db Add statistics collector 2019-10-29 16:40:53 +03:00
Yan Zhulanow 39662c09e9 Debugger: Fix breakpoints and stepping on a first line (KT-33304)
This commit fixes the 'SmartStepIntoTestGenerated#testFunWithExpressionBody' test.
2019-10-24 21:32:59 +09:00
Dmitry Gridin 474645f04f idea-core: fix compatibility of insertMembersAfter function 2019-10-23 20:10:34 +07:00
Vladimir Dolzhenko 30229da95a Don't render pure error types in OverrideMemberChooserObject
#KT-34379 Fixed
2019-10-21 17:18:23 +02:00
Vladimir Dolzhenko 15997bf635 Save change script configuration within a transaction
#EA-214281 Fixed
2019-10-21 17:18:22 +02:00
Igor Yakovlev 6ce37fff95 Add UL support for AllOpen compiler plugin 2019-10-18 23:22:47 +03:00
Dmitry Gridin 92bfb2788e idea: cleanup "Remove redundant qualifier name" 2019-10-17 14:30:25 +07:00
Dmitry Gridin 8161403e69 ShortenReferences: shouldn't analyze root prefix elements & should get rid of them at end
Relates to #KT-33937
2019-10-16 15:59:47 +07:00
Anton Yalyshev 1e921647fe Bump FUS Collectors versions after last changes for proper data fetching 2019-10-15 16:15:10 +03:00