Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CARGO: Annotate basic docs in cargo.toml #1793

Merged
merged 1 commit into from
Dec 7, 2017

Conversation

farodin91
Copy link
Contributor

Fixes #1776
@matklad Any idea to fix the problem with the test?

@@ -20,9 +20,10 @@
<!-- please see https://confluence.jetbrains.com/display/IDEADEV/Plugin+Compatibility+with+IntelliJ+Platform+Products
on how to target different products -->

<depends>com.intellij.modules.lang</depends>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I believe this is a required dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea

<depends optional="true" config-file="idea-only.xml">com.intellij.modules.java</depends>
<depends optional="true" config-file="clion-only.xml">com.intellij.modules.clion</depends>
<depends optional="true" config-file="clion-only.xml">com.intellij.modules.clion</depends>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jo

@matklad
Copy link
Member

matklad commented Sep 29, 2017

Not sure what's up with tests, restarted the build.

build.gradle.kts Outdated
@@ -13,6 +13,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
buildscript {
repositories {
maven { setUrl("https://jitpack.io") }
maven { setUrl("http://dl.bintray.com/jetbrains/intellij-plugin-service") }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use https for this repository?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed it

@farodin91
Copy link
Contributor Author

local error if i run the test

ERROR: Problems found loading plugins:<p/>Plugin "Rust" was not loaded: required plugin "org.toml.lang" not installed.<p/><br><a href="disable">Disable Rust</a><p/><a href="edit">Open plugin manager</a>
java.lang.Throwable
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:132)
	at com.intellij.ide.plugins.PluginManagerCore.prepareLoadingPluginsErrorMessage(PluginManagerCore.java:556)
	at com.intellij.ide.plugins.PluginManagerCore.initializePlugins(PluginManagerCore.java:1202)
	at com.intellij.ide.plugins.PluginManagerCore.initPlugins(PluginManagerCore.java:1362)
	at com.intellij.ide.plugins.PluginManagerCore.getPlugins(PluginManagerCore.java:122)
	at com.intellij.ide.plugins.PluginManagerCore.getPlugins(PluginManagerCore.java:116)
	at com.intellij.idea.IdeaApplication.getStarter(IdeaApplication.java:188)
	at com.intellij.idea.IdeaApplication.<init>(IdeaApplication.java:114)
	at com.intellij.openapi.application.impl.ApplicationImpl.<init>(ApplicationImpl.java:218)
	at com.intellij.openapi.application.ex.ApplicationManagerEx.createApplication(ApplicationManagerEx.java:45)
	at com.intellij.idea.CommandLineApplication.<init>(CommandLineApplication.java:45)
	at com.intellij.idea.CommandLineApplication.<init>(CommandLineApplication.java:38)
	at com.intellij.idea.IdeaTestApplication.<init>(IdeaTestApplication.java:32)
	at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:52)
	at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:46)
	at com.intellij.testFramework.LightPlatformTestCase.initApplication(LightPlatformTestCase.java:167)
	at com.intellij.testFramework.fixtures.impl.LightIdeaTestFixtureImpl.setUp(LightIdeaTestFixtureImpl.java:48)
	at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$setUp$13(CodeInsightTestFixtureImpl.java:1157)
	at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:29)
	at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:27)
	at com.intellij.testFramework.EdtTestUtilKt.runInEdtAndWait(EdtTestUtil.kt:58)
	at com.intellij.testFramework.EdtTestUtil$Companion.runInEdtAndWait(EdtTestUtil.kt:29)
	at com.intellij.testFramework.EdtTestUtil.runInEdtAndWait(EdtTestUtil.kt)
	at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.setUp(CodeInsightTestFixtureImpl.java:1156)
	at com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase.setUp(LightPlatformCodeInsightFixtureTestCase.java:57)
	at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:353)
	at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:29)
	at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:27)
	at com.intellij.testFramework.EdtTestUtilKt$runInEdtAndWait$2.run(EdtTestUtil.kt:62)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:345)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

java.lang.AssertionError: Problems found loading plugins:<p/>Plugin "Rust" was not loaded: required plugin "org.toml.lang" not installed.<p/><br><a href="disable">Disable Rust</a><p/><a href="edit">Open plugin manager</a>

	at com.intellij.testFramework.LoggedErrorProcessor.processError(LoggedErrorProcessor.java:61)
	at com.intellij.testFramework.TestLogger.error(TestLogger.java:40)
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:132)
	at com.intellij.ide.plugins.PluginManagerCore.prepareLoadingPluginsErrorMessage(PluginManagerCore.java:556)
	at com.intellij.ide.plugins.PluginManagerCore.initializePlugins(PluginManagerCore.java:1202)
	at com.intellij.ide.plugins.PluginManagerCore.initPlugins(PluginManagerCore.java:1362)
	at com.intellij.ide.plugins.PluginManagerCore.getPlugins(PluginManagerCore.java:122)
	at com.intellij.ide.plugins.PluginManagerCore.getPlugins(PluginManagerCore.java:116)
	at com.intellij.idea.IdeaApplication.getStarter(IdeaApplication.java:188)
	at com.intellij.idea.IdeaApplication.<init>(IdeaApplication.java:114)
	at com.intellij.openapi.application.impl.ApplicationImpl.<init>(ApplicationImpl.java:218)
	at com.intellij.openapi.application.ex.ApplicationManagerEx.createApplication(ApplicationManagerEx.java:45)
	at com.intellij.idea.CommandLineApplication.<init>(CommandLineApplication.java:45)
	at com.intellij.idea.CommandLineApplication.<init>(CommandLineApplication.java:38)
	at com.intellij.idea.IdeaTestApplication.<init>(IdeaTestApplication.java:32)
	at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:52)
	at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:46)
	at com.intellij.testFramework.LightPlatformTestCase.initApplication(LightPlatformTestCase.java:167)
	at com.intellij.testFramework.fixtures.impl.LightIdeaTestFixtureImpl.setUp(LightIdeaTestFixtureImpl.java:48)
	at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$setUp$13(CodeInsightTestFixtureImpl.java:1157)
	at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:29)
	at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:27)
	at com.intellij.testFramework.EdtTestUtilKt.runInEdtAndWait(EdtTestUtil.kt:58)
	at com.intellij.testFramework.EdtTestUtil$Companion.runInEdtAndWait(EdtTestUtil.kt:29)
	at com.intellij.testFramework.EdtTestUtil.runInEdtAndWait(EdtTestUtil.kt)
	at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.setUp(CodeInsightTestFixtureImpl.java:1156)
	at com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase.setUp(LightPlatformCodeInsightFixtureTestCase.java:57)
	at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:353)
	at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:29)
	at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:27)
	at com.intellij.testFramework.EdtTestUtilKt$runInEdtAndWait$2.run(EdtTestUtil.kt:62)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:345)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.Throwable
	... 44 more


Process finished with exit code 255

build.gradle.kts Outdated
intellij { pluginName = "intellij-rust" }
intellij {
pluginName = "intellij-rust"
setPlugins("org.toml.lang:0.0.1.1759")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should specify a path to Gradle subproject here, like project(':toml').

@farodin91
Copy link
Contributor Author

Changed, but this i didn't fix my problem.

@matklad matklad self-assigned this Oct 2, 2017
@matklad
Copy link
Member

matklad commented Oct 2, 2017

@farodin91 looking into this, and I don't know what's going on here :( I think I had a similar (closed source) project with exactly this setup, and it did work there...

@farodin91
Copy link
Contributor Author

@matklad Any suggestions?

@matklad
Copy link
Member

matklad commented Oct 9, 2017

@farodin91 I think I've found a bug in intellij gradle plugin, will try to fix it soon.

@matklad
Copy link
Member

matklad commented Oct 9, 2017

The workaround to change :toml project name to :intellij-toml in settings.gralde and build.kts:

// settings.gradle
project(":toml").name = "intellij-toml"

// buil.dtks
project(":intelij-toml")

@farodin91
Copy link
Contributor Author

This breaks all for me.

@farodin91
Copy link
Contributor Author

All Toml types are unresolved

@farodin91
Copy link
Contributor Author

Found I copied with look into the code. ;)

@farodin91
Copy link
Contributor Author

Resolved

@matklad
Copy link
Member

matklad commented Oct 9, 2017

The fix for the gradle plugin: JetBrains/intellij-platform-gradle-plugin#238

@farodin91
Copy link
Contributor Author

farodin91 commented Oct 10, 2017

@matklad merge conflicts fixed

@farodin91
Copy link
Contributor Author

@matklad Merge conflicts are fixed.

@matklad
Copy link
Member

matklad commented Oct 19, 2017

Looking good @farodin91

The gradle plugin is not released yet, but I think we can use snapshot versions for some time.

One thing I would like to do here though is to change <depends>org.toml.lang</depends> to <depends optional="true" config-file="with-toml-plugin.xml">org.toml.lang</depends>, so that the Rust plugin is able to function without TOML plugin installed. And perhaps we should create an org.rust.toml package for all code that depends on the TOML plugin.

@farodin91
Copy link
Contributor Author

@matklad fixed

@farodin91
Copy link
Contributor Author

@maklad resolved latest merge conflict

@matklad
Copy link
Member

matklad commented Oct 24, 2017

@farodin91 What about making dependency on the TOML plugin optional? #1793 (comment)

@farodin91
Copy link
Contributor Author

I rebased the false commit.

@farodin91
Copy link
Contributor Author

@matklad should I move this to linemarkers

@matklad
Copy link
Member

matklad commented Nov 3, 2017

@farodin91 I think this should all be moved to a top-level cargoToml package, like org.rust.cargoToml.

I am also still a bit uneasy about depending on the TOML plugin API, as they are not great at the moment, and changing them later will result in class cast exceptions. I'll try to make TOML APIs more stable.

@matklad
Copy link
Member

matklad commented Nov 3, 2017

Branch with a (hopefully :) ) better TOML plugin: https://github.com/intellij-rust/intellij-rust/tree/toml

@farodin91
Copy link
Contributor Author

@matklad Will wait until your PR is merged.

@farodin91
Copy link
Contributor Author

@matklad I try to fix all problems.

@farodin91
Copy link
Contributor Author

@matklad Inlinetable is longer a TomlValue

@matklad
Copy link
Member

matklad commented Nov 22, 2017

@matklad Inlinetable is longer a TomlValue

Ouch, that's a blunder from my side!

Fixed in: #2057.

Will make a toml plugin release later today.

@matklad
Copy link
Member

matklad commented Nov 23, 2017

The toml plugin is released and the dependency is updated.

@farodin91
Copy link
Contributor Author

@matklad You changed the build.gradle.kts but intellij is trying to use toml in versio 0.2.0.8 not 0.2.0.9

@matklad
Copy link
Member

matklad commented Nov 24, 2017

@matklad You changed the build.gradle.kts but intellij is trying to use toml in versio 0.2.0.8 not 0.2.0.9

Probably some issues with caches. Deleting ./build and ./deps may fix the issue.

@farodin91
Copy link
Contributor Author

@matklad Do you like to review?

class CargoCrateDocLineMarkerProvider : LineMarkerProvider {
override fun getLineMarkerInfo(element: PsiElement): LineMarkerInfo<PsiElement>? = null

override fun collectSlowLineMarkers(elements: MutableList<PsiElement>, result: MutableCollection<LineMarkerInfo<PsiElement>>) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add an ABI check here, the same way it is done in CargoTomlCompletionContributor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the same. Is this okay?

fun `test no link to doc`() = doTestByText("""
[dependencies]
hello_utils = { path = "hello_utils" }
""")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 great tests!

@farodin91 farodin91 force-pushed the cargo-toml-ref branch 2 times, most recently from 2a34892 to ba2ccba Compare November 27, 2017 08:51
@farodin91
Copy link
Contributor Author

@matklad I have no idea. Why nightly crashes?

@matklad
Copy link
Member

matklad commented Nov 27, 2017

@farodin91 I think it's

org.rust.toml.CargoCrateDocLineMarkerProviderTest > test standard build FAILED

java.lang.AssertionError: Performance warning: LineMarker is supposed to be registered for leaf elements only, but got: TomlKeyValue (class org.toml.lang.psi.impl.TomlKeyValueImpl) instead. First child: TomlKey (class org.toml.lang.psi.impl.TomlKeyImpl)

Please see LineMarkerProvider#getLineMarkerInfo(PsiElement) javadoc for detailed explanations.

See how other lines markers were fixed recently.

@farodin91
Copy link
Contributor Author

@matklad Resolved ? Do you like to review?


private fun genLineMarkerInfo(element: PsiElement, name: String, version: String?): LineMarkerInfo<PsiElement>? {
val version = version ?: return null
val anchor = PsiTreeUtil.getDeepestFirst(element)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, it's super non-obvious what element is returned here... Could we be somehow more specific?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I change this to fix the problem with the leaf.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this okay?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to anchor on the specific toml element, instead of using just PsiElement. So, we probably want to annotate TomlKey child with type BARE_KEY:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most definitely!

@matklad
Copy link
Member

matklad commented Dec 7, 2017

@bors r+

Thanks!

@Undin
Copy link
Member

Undin commented Dec 7, 2017

bors r=matklad

bors bot added a commit that referenced this pull request Dec 7, 2017
1793: CARGO: Annotate basic docs in cargo.toml r=matklad a=farodin91

Fixes #1776 
@matklad Any idea to fix the problem with the test?
@bors
Copy link
Contributor

bors bot commented Dec 7, 2017

@bors bors bot merged commit 5c4dc21 into intellij-rust:master Dec 7, 2017
@farodin91 farodin91 deleted the cargo-toml-ref branch April 2, 2018 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add docs gutter in cargo.toml for dep.
4 participants