Giter VIP home page Giter VIP logo

Comments (4)

nwolverson avatar nwolverson commented on July 21, 2024 1

I think I have it in 3fb5f18

from purescript-language-server.

i-am-the-slime avatar i-am-the-slime commented on July 21, 2024

I think this happens in the following combination:

There's both an unnecessary import for a data constructor and some unused functions on the same line ((..) and fromMaybe are unnecessary in this example):

import Data.Maybe (Maybe(..), fromMaybe)

example :: Maybe String -> Maybe String
example = identity

🔝 breaks.

When they occur in isolation it works (only fromMaybe is redundant here):

import Data.Maybe (Maybe(..), fromMaybe)
import PscIdeClient (compileCode)

example :: Maybe String -> Maybe String
example _ = Just ""

as well as (only (..) is redundant here)

import Data.Maybe (Maybe(..), fromMaybe)

example :: Maybe String -> Maybe String
example = identity

example2 = fromMaybe

work.

from purescript-language-server.

i-am-the-slime avatar i-am-the-slime commented on July 21, 2024

After more investigation something surprising happens for the first example when specifying: "Apply suggestion" on the line in question. It does what it should and leaves us with:
import Data.Maybe (Maybe) the same is true for "Remove unused reference". It also produces the complete correct result.

from purescript-language-server.

nwolverson avatar nwolverson commented on July 21, 2024

PR #78 fixes this case for me, but the following fails:

import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)

example :: Maybe String -> Maybe String
example = identity

I think this is just due to overlaps being prohibited, in this case they are still present due to not being simple duplicates. It's clear in the LSP spec that overlaps are not permitted, but I think either earlier versions of vscode allowed this or the other form of edit in the earlier LSP spec did so.

from purescript-language-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.