Skip to content

Commit

Permalink
Fix some deprecation warnings (#545)
Browse files Browse the repository at this point in the history
* Fix some deprecation warnings

* Spotless

---------

Co-authored-by: hfhbd <[email protected]>
  • Loading branch information
hfhbd and hfhbd authored Aug 7, 2023
1 parent 0dff525 commit 04bb66e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import com.intellij.core.CoreProjectEnvironment
import com.intellij.lang.MetaLanguage
import com.intellij.openapi.diagnostic.DefaultLogger
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.extensions.Extensions
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.ContentIterator
import com.intellij.openapi.roots.ProjectFileIndex
Expand Down Expand Up @@ -47,13 +46,11 @@ private object ApplicationEnvironment {
CoreApplicationEnvironment(Disposer.newDisposable()).apply {
Logger.setFactory { logger }

CoreApplicationEnvironment.registerExtensionPoint(
Extensions.getRootArea(),
CoreApplicationEnvironment.registerApplicationExtensionPoint(
MetaLanguage.EP_NAME,
MetaLanguage::class.java,
)
CoreApplicationEnvironment.registerExtensionPoint(
Extensions.getRootArea(),
CoreApplicationEnvironment.registerApplicationExtensionPoint(
SmartPointerAnchorProvider.EP_NAME,
SmartPointerAnchorProvider::class.java,
)
Expand All @@ -76,13 +73,11 @@ open class SqlCoreEnvironment(
ApplicationEnvironment.coreApplicationEnvironment,
)

protected val localFileSystem: VirtualFileSystem
protected val localFileSystem: VirtualFileSystem = VirtualFileManager.getInstance().getFileSystem(
StandardFileSystems.FILE_PROTOCOL,
)

init {
localFileSystem = VirtualFileManager.getInstance().getFileSystem(
StandardFileSystems.FILE_PROTOCOL,
)

projectEnvironment.registerProjectComponent(
ProjectRootManager::class.java,
ProjectRootManagerImpl(projectEnvironment.project),
Expand Down Expand Up @@ -182,8 +177,8 @@ open class SqlCoreEnvironment(
} catch (e: Throwable) {
throw IllegalStateException(
"""
|Failed to compile ${this.containingFile.virtualFile.path}:${this.node.startOffset}:
| ${this.text}
|Failed to compile ${containingFile.virtualFile.path}:${node.startOffset}:
| $text
|
""".trimMargin(),
e,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.alecstrong.sql.psi.core.psi

import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.components.serviceOrNull
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
Expand All @@ -18,8 +18,7 @@ interface SchemaContributorIndex {
}

fun getInstance(project: Project): SchemaContributorIndex {
return ServiceManager.getService(project, SchemaContributorIndex::class.java)
?: SchemaContributorIndexImpl.instance
return project.serviceOrNull() ?: SchemaContributorIndexImpl.instance
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions sample-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ sourceSets {
dependencies {
implementation project(":sample-core")
}

tasks.named('buildSearchableOptions') { enabled = false }

This file was deleted.

6 changes: 5 additions & 1 deletion sample-plugin/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
<extensions defaultExtensionNs="com.intellij">
<lang.parserDefinition language="Sample" implementationClass="com.alecstrong.sql.psi.sample.core.SampleParserDefinition" />
<annotator language="Sample" implementationClass="com.alecstrong.sql.psi.core.SqlAnnotator"/>
<fileTypeFactory implementation="com.alecstrong.sql.psi.sample.plugin.SampleFileTypeFactory"/>
<fileType name="Sample File"
language="Sample"
implementationClass="com.alecstrong.sql.psi.sample.core.SampleFileType"
extensions="samplesql"
fieldName="INSTANCE"/>
<stubIndex implementation="com.alecstrong.sql.psi.core.psi.SchemaContributorIndexImpl"/>
<stubElementTypeHolder class="com.alecstrong.sql.psi.core.psi.SqlTypes"/>
</extensions>
Expand Down

0 comments on commit 04bb66e

Please sign in to comment.