mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[IJPL-162329] Collect FUS information about the installed editors.
For the moment, only the information about the .vimrc configuration file is collected. (cherry picked from commit a0f467ff132dc51dafbff746529375c82486fdf6) IJ-MR-151660 GitOrigin-RevId: 7f5c47a6189bd40413936fb1c64493b9347efc78
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0f3d5b9334
commit
7c0a2e792f
@@ -0,0 +1,43 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.internal.statistic.collectors.fus.competitors
|
||||
|
||||
import com.intellij.internal.statistic.beans.MetricEvent
|
||||
import com.intellij.internal.statistic.eventLog.EventLogGroup
|
||||
import com.intellij.internal.statistic.eventLog.events.EventFields
|
||||
import com.intellij.internal.statistic.eventLog.events.EventId1
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
|
||||
internal class EditorsCollector : ApplicationUsagesCollector() {
|
||||
private val EDITORS_GROUP: EventLogGroup = EventLogGroup("editors", 1)
|
||||
|
||||
override fun getGroup(): EventLogGroup = EDITORS_GROUP
|
||||
|
||||
private val CONFIGS: List<String> = listOf(
|
||||
".vimrc", // Settings for Vim-like editors. Actual file may be different, e.g. `_vimrc` on Windows.
|
||||
)
|
||||
|
||||
private val CONFIG_EXISTS: EventId1<String> = EDITORS_GROUP.registerEvent(
|
||||
"config.exists",
|
||||
EventFields.String("config", CONFIGS)
|
||||
)
|
||||
|
||||
override suspend fun getMetricsAsync(): Set<MetricEvent> {
|
||||
val homeDir = System.getProperty("user.home")
|
||||
return withContext(Dispatchers.IO) {
|
||||
buildSet {
|
||||
// Vim configuration files
|
||||
if (
|
||||
Files.exists(Paths.get(homeDir, ".vimrc")) ||
|
||||
Files.exists(Paths.get(homeDir, "_vimrc")) ||
|
||||
Files.exists(Paths.get(homeDir, ".vim/vimrc"))
|
||||
) {
|
||||
add(CONFIG_EXISTS.metric(".vimrc"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1052,6 +1052,7 @@
|
||||
<statistics.counterUsagesCollector implementationClass="com.intellij.openapi.fileChooser.impl.FileChooserUsageCollector"/>
|
||||
<statistics.counterUsagesCollector implementationClass="com.intellij.openapi.editor.markup.InspectionsFUS"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.build.BuildToolsCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.competitors.EditorsCollector"/>
|
||||
|
||||
<fileTypeUsageSchemaDescriptor schema="DotBazelFile"
|
||||
implementationClass="com.intellij.internal.statistic.collectors.fus.build.DotBazelFileTypeUsageSchemaDescriptor"/>
|
||||
|
||||
Reference in New Issue
Block a user