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

Lint messages are shown for adjacent files #18

Closed
vafu opened this issue Apr 22, 2020 · 5 comments
Closed

Lint messages are shown for adjacent files #18

vafu opened this issue Apr 22, 2020 · 5 comments

Comments

@vafu
Copy link

vafu commented Apr 22, 2020

I'm using "ktlint" for Kotlin and I see lint messages shown not only for opened file, but for adjacent ones.
I'm using coc extension.

{
    "languageserver": {
        "kotlin": {
	    "command": "kotlin-language-server",
	        "filetypes": ["kotlin"]
        },

        "dls": {
            "command": "diagnostic-languageserver",
            "args": ["--stdio"],
            "filetypes": [ "kotlin" ],
            "initializationOptions": {
                "linters": {
                    "ktlint": {
                        "command": "ktlint",
                        "sourceName": "ktlint",
                        "formatLines": 1,
                        "formatPattern": [ 
                            "^[^:]+:(\\d+):(\\d+):\\s+(.*)$",
                            { 
                                "line": 1,
                                "column": 2,
                                "message" : [0]
                            }
                        ]
                    }
                },
                "formatters": {
                    "ktlint" : {
                        "command": "ktlint",
                        "args" : [ "--format"]
                    }
                },
                "filetypes": {
                    "kotlin": "ktlint"
                },
                "formatFileTypes" : {
                    "kotlin": "ktlint"
                }
            }
        }
    }
}
@vafu
Copy link
Author

vafu commented Apr 22, 2020

image
here I intentionally made an error in file B.
however it's shown in file A.

@iamcco
Copy link
Owner

iamcco commented Apr 23, 2020

You should make sure to config kotlin only lint the file you open.

@vafu
Copy link
Author

vafu commented Apr 23, 2020

@iamcco how can I provide current file parameter to the linter using json config ?

@iamcco
Copy link
Owner

iamcco commented Apr 23, 2020

@vafu
Copy link
Author

vafu commented Apr 23, 2020

"args" : [ "%filename" ],` did the trick, thank you

@vafu vafu closed this as completed Apr 23, 2020
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