Title: Feature: opt-in gate on Spring Boot project detection before starting LSP · Issue #30 · JavaHello/spring-boot.nvim · GitHub
Open Graph Title: Feature: opt-in gate on Spring Boot project detection before starting LSP · Issue #30 · JavaHello/spring-boot.nvim
X Title: Feature: opt-in gate on Spring Boot project detection before starting LSP · Issue #30 · JavaHello/spring-boot.nvim
Description: Use case I work in a polyglot Java environment where some projects are Spring Boot, many are Jersey / plain libraries, and others are mixed-language repos that happen to have a few .java and .yaml files. spring-boot.nvim's current behavi...
Open Graph Description: Use case I work in a polyglot Java environment where some projects are Spring Boot, many are Jersey / plain libraries, and others are mixed-language repos that happen to have a few .java and .yaml ...
X Description: Use case I work in a polyglot Java environment where some projects are Spring Boot, many are Jersey / plain libraries, and others are mixed-language repos that happen to have a few .java and .yaml ...
Opengraph URL: https://github.com/JavaHello/spring-boot.nvim/issues/30
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature: opt-in gate on Spring Boot project detection before starting LSP","articleBody":"## Use case\n\nI work in a polyglot Java environment where some projects are Spring Boot,\nmany are Jersey / plain libraries, and others are mixed-language repos\nthat happen to have a few `.java` and `.yaml` files. spring-boot.nvim's\ncurrent behaviour is to start the (fairly heavy) Spring Boot LSP for\n**every** `java` and `yaml` buffer, regardless of whether the project\nactually uses Spring Boot.\n\nFor Spring-only environments this is fine. For polyglot setups it's\nexpensive — booting a JVM-based language server you'll never use, plus\nthe LSP attaches to unrelated YAML buffers (`docker-compose.yml`,\n`.gitlab-ci.yml`, helm values, etc.).\n\n## Current behaviour\n\nThe plugin registers an autocmd (group `spring_boot_ls`) that\nunconditionally starts the Spring Boot LSP on `BufRead` / `BufNewFile` of\n`java` and `yaml` filetypes.\n\n## Proposed behaviour (opt-in)\n\nA `setup({ ... })` option such as:\n\n```lua\nrequire('spring-boot.nvim').setup({\n -- default false (current behaviour preserved)\n require_spring_boot_project = true,\n})\n```\n\nWhen `true`, before starting the LSP, walk up from the buffer's path\nlooking for `pom.xml` / `build.gradle[.kts]`, then grep that file for\n`spring-boot`. Only start the LSP if found.\n\nThe existing default stays unchanged, so this is non-breaking.\n\n## Prototype\n\nI'm already using a local wrapper that does exactly this — it overrides\nthe `spring_boot_ls` autocmd group with a gated version. Sketch:\n\n```lua\nlocal function is_spring_project(bufnr)\n local root = vim.fs.root(bufnr or 0, {\n 'pom.xml', 'build.gradle', 'build.gradle.kts',\n 'settings.gradle', 'settings.gradle.kts',\n })\n if not root then return false end\n for _, fname in ipairs({ 'pom.xml', 'build.gradle', 'build.gradle.kts' }) do\n local p = root .. '/' .. fname\n if vim.fn.filereadable(p) == 1 then\n for _, line in ipairs(vim.fn.readfile(p, '', 500)) do\n if line:match('spring%-boot') then return true end\n end\n end\n end\n return false\nend\n\n-- Replace each existing 'spring_boot_ls' autocmd callback with one that\n-- bails early when is_spring_project(bufnr) is false.\n```\n\nIt works well for me but it's brittle — it depends on your group name\nstaying `spring_boot_ls` and the autocmd shape staying the same. A\nproper opt-in inside the plugin would be more robust and benefit other\npolyglot users.\n\n## Questions\n\n- Would you be open to a PR adding this as an opt-in option?\n- If yes, do you have a preferred name for the option? `require_spring_boot_project`,\n `gate_on_project_detection`, `auto_detect`, something else?\n- Does the file scan (grep `pom.xml` / `build.gradle` for `spring-boot`)\n feel right, or would you prefer a stricter check (e.g. dependency\n resolution via maven-resolver)?\n\nHappy to send a PR once we agree on the shape.\n\n---\n\n🤖 Filed via Claude Code on behalf of @fobbyal","author":{"url":"https://github.com/fobbyal","@type":"Person","name":"fobbyal"},"datePublished":"2026-06-05T04:01:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/30/spring-boot.nvim/issues/30"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e2555a99-dc63-f095-ed05-2e315ce5dece |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AFEE:228F1C:2D279E2:3DCED4C:6A53D0C0 |
| html-safe-nonce | 302fd9d948e8c9bfa9556a5c7382f131caf52da46f56859cc6da116c392c52ad |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkVFOjIyOEYxQzoyRDI3OUUyOjNEQ0VENEM6NkE1M0QwQzAiLCJ2aXNpdG9yX2lkIjoiODI2NTIyNTcwNzQ3MjUzOTg0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | dac397423f6dce12d6f448661e61cda185e5c9883149db8e6816c78def7fcc00 |
| hovercard-subject-tag | issue:4594056841 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaHello/spring-boot.nvim/30/issue_layout |
| twitter:image | https://opengraph.githubassets.com/092cd3cd8db0514d69aa1a4cca292085e4756e404dcb94630ba7fd436c897aab/JavaHello/spring-boot.nvim/issues/30 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/092cd3cd8db0514d69aa1a4cca292085e4756e404dcb94630ba7fd436c897aab/JavaHello/spring-boot.nvim/issues/30 |
| og:image:alt | Use case I work in a polyglot Java environment where some projects are Spring Boot, many are Jersey / plain libraries, and others are mixed-language repos that happen to have a few .java and .yaml ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fobbyal |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaHello/spring-boot.nvim git https://github.com/JavaHello/spring-boot.nvim.git |
| octolytics-dimension-user_id | 24937965 |
| octolytics-dimension-user_login | JavaHello |
| octolytics-dimension-repository_id | 785555003 |
| octolytics-dimension-repository_nwo | JavaHello/spring-boot.nvim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 785555003 |
| octolytics-dimension-repository_network_root_nwo | JavaHello/spring-boot.nvim |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width