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

referencing package corrupts import block #20

Open
hareldvd opened this issue Aug 24, 2023 · 2 comments
Open

referencing package corrupts import block #20

hareldvd opened this issue Aug 24, 2023 · 2 comments

Comments

@hareldvd
Copy link

Greetings.

When I add reference to a package that is not yet defined in the import block the automatic import mechanism corrupts the import block. Here is a review of what happens when I added a reference to the package "db" (reside in findbom/golang/db)

before making the reference:

import (
    "testing"
    "net/http"

    "github.com/stretchr/testify/assert"
)

after making the reference

import (
    	       "tesftdolang/dbbom/ing"
    	       "net/http"
    	       "testing"

	"github.com/stretchr/testify/assert"
)

expected import block

import (
    "testing"
    "net/http"

    "findbom/golang/db"
    "github.com/stretchr/testify/assert"
)

Please note that in the editor, I changed tab space to 4 spaces. Maybe that is the reason.

Thanks for the great work you do on this package

@MordFustang21
Copy link
Owner

It should be injecting directly whatever change came from gopls which should be tab characters. I'm assuming the issue is something similar to what you suggested where there's a mix of tabs and spaces in the file. As for the imports not being grouped like in the expected import block there's a separate part of the spec that has to be called to get that which is

         **
	 * Base kind for an organize imports source action:
	 * `source.organizeImports`.
	 */
	export const SourceOrganizeImports: [CodeActionKind](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeActionKind) =
		'source.organizeImports';

And I don't think that's actually implemented in atom. Also curious are you running this in atom or in the pulsar fork?

@hareldvd
Copy link
Author

hareldvd commented Aug 27, 2023 via email

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

No branches or pull requests

2 participants