nwolverson / vscode-ide-purescript Goto Github PK
View Code? Open in Web Editor NEWPureScript IDE support for VS Code
Home Page: https://marketplace.visualstudio.com/items/nwolverson.ide-purescript
License: MIT License
PureScript IDE support for VS Code
Home Page: https://marketplace.visualstudio.com/items/nwolverson.ide-purescript
License: MIT License
I noticed because I see censored warnings but realized it's just fast rebuild. When it's disabled would it be reasonable to queue up a normal build?
Can be broken on windows... microsoft/vscode#3128
I tried setting fastRebuild
to false
in my default language configuration (opting to only enable it per project), but I don't think this settings does anything anymore. Often times the plugin is too eager about trying to launch a server. For example, just opening the PureScript language settings in a fresh window tries to launch a server (resulting in an error). Sometimes I want to open up or work on random PureScript files, and the launch errors are off-putting.
Whenever I have imports, the IDE breaks on import statements claiming they were not found with the following error message:
Module Control.Monad.State was not found.
Make sure the source file exists, and that it has been provided as an input to psc.
Is there a fix for this or is it a bug?
Purescript version: 0.11.4
Pulp version: 11.0.0
When we save the file we just sometimes get "Build Error :(" and no error reporting.
When we checked the Developer Tools, we were able to see ECONNREFUSED error.
Thanks in Advance for the fix.
I was working late last night without connectivity and had to figure out by associated filename.
Trying to "go to definition" on 0.8.1 is failing, trying to open the source at /bower_components/../...purs
I've hacked a solution by making the following change to Location.ts, but i doubt this is the right solution:
import { workspace, Position, Location, Uri } from 'vscode';
import * as Path from 'path';
export const mkLocation = (file : string) => (pos: Position) => {
var fullPath = Path.resolve(workspace.rootPath, file)
return new Location(Uri.file(fullPath), pos);
}
if this is good enough for now i can submit a PR though
I think this requires effectively psc-ide complete
command to return source information. (or a lot of calls)
https://code.visualstudio.com/docs/extensionAPI/vscode-api#DocumentSymbolProvider
https://code.visualstudio.com/docs/extensionAPI/vscode-api#WorkspaceSymbolProvider
@kritzcreek is there a reason this is provided just for type
query - is it expensive to query? Looks to me like it's there but discarded
…when I open a new project with Cmd+O (consequently closing the active one).
Somehow tagged latest with an older version. So the new default for "use purs
" is not enabled if you get latest
If I start typing import SlamData.Eff
, I'll get the auto-complete for SlamData.Effects
, but if I accept, it inserts SlamData.SlamData.Effects
.
Hi Nicholas,
I'm researching IDEs and I was wondering if you could share your experiences writing plugins for both Atom and VS Code. Do you prefer one over the other and if you have to support just one IDE, which one would you prefer?
Thanks,
Rajiv
Due to the .cmd
thing of npm installed commands. Unlike atom the configuration defaults are json rather than dynamic so need to do something different. Works when manually specified.
I think this should work after nwolverson/vscode-language-purescript#1:
{
"key": "shift+cmd+b",
"command": "purescript.build",
"when": "editorTextFocus && editorLangId == 'purescript'"
}
Similar to nwolverson/atom-ide-purescript#140. It causes psc-ide-server
to crash, but really it's unnecessary to query with a file known to not exist.
Tooltips are not appearing when I hover over symbols. To complicate things somewhat I'm running VS Code on Ubuntu 16.04 inside a virtualbox guest on a windows 10 host.
VScode supports variable substitution in certain config variables. Supporting it in the "purescript.pscIdeServerExe"
config variable would allow me to specify a local node binary relative to project root. Currently this doesn't work as evidenced by the error below:
Couldn't find psc-ide-server, check PATH. Looked for: ${workspaceRoot}/node_modules/.bin/psc-ide-server in PATH: [snip]
When I run a build which should fail, it instead gave an info message "Build success!"
Rebuild successfully failed.
I'm getting a build error in VS Code when i try to use the pulp build command from the command palette, so i thought i would try the build on the command line.
bash-3.2$ pulp --version
Pulp version 10.0.0
psc version 0.10.5 using /usr/local/bin/psc
bash-3.2$ pulp build --no-psa --json-errors
Error: Unrecognised arguments: --json-errors
I see that psc supports --json-errors
bash-3.2$ psc --help
--json-errors Print errors to stderr as JSON
But i don't see any support for that with pulp
bash-3.2$ pulp build --help
--no-psa Do not attempt to use the psa frontend instead of pic
Ideas?
Not figured out what the conditions are yet. Occasionally I hit tab to complete and add import, and the entire document other than the module definition is wiped out. Undo brings it back.
Should be able to easily get syntax highlighting in tooltips I think
Finish sharing suggestions code with atom package & pull more out of .ts
(eg - "Apply Suggestion" text is customised)
Hello,
I often go to Pursuit in order to search a function by a type definition.
Would it be possible to integrate a command to search directly on Pursuit within VS Code ?
I think this requires psc 0.9.2 due to passing globs to psc-ide-server.
Probably should follow the same policy as atom package - support compiler from last patch of prior minor version up to current version.
This works in Atom to autocomplete specifically modules in the context of imports.
I used to be able to run psc-ide-server in debug mode, and then when I reloaded the window it would connect to the running instance. Now when I reload the window it appears to always kill the existing server, start up a new one, and overwrite the .psc-ide-port
file. This is making it difficult to debug some issues I'm having.
For people starting to use psc-package (or whatever else) instead of bower, it would be nice to have the option to override the "bower_components" search path. I can create and submit a PR for this if you like.
Here is what I have:
module A where
-- empty line
import Prelude
-- empty line
f :: String -> Maybe String
Go after Maybe, press Ctrl+Space. This imports Data.Maybe and I want this:
module A where
-- empty line
import Prelude
import Data.Maybe (Maybe)
-- empty line
f :: String -> Maybe String
But I get this:
module A where
-- empty line
import Prelude
import Data.Maybe (Maybe)
f :: String -> Maybe String
It eats declarations when no empty lines exist. Works on Linux.
Pulp version 11.0.0
purs version 0.11.3
On Windows, this command does nothing (probably connected with the other issue). Is it necessary to provide some special setting when using on Windows? Could you please give a hint how to?
By the way, should it work the same way as in Atom, i.e. build once saved?
Thank you.
In Atom I changed non-essential notifications to use a status bar icon instead, I think we also have an API for that here. Could think about this as well as reducing some.
Would it be generally useful to open the corresponding FFI file to the side? Go to definition
for foreign import
s would be better but sounds difficult.
I somewhat frequently initiate a full rebuild, which will yield errors across the whole project. If I go to one of those files and fix them, initiating a fast rebuild, all the errors disappear and I have to rebuild again. It would be nice if it would merge the errors instead.
Hi,
This may very well be due to a lack of understanding of how psc-package
works but I'm getting a build error while trying to build in vscode
from a psc-package
created personal project
Details:
Steps:
psc-package init
and psc-package build
vscode
vscode
displays Started psc-ide-server (port 15206)
messagesrc/Trial.purs
)Cmd+Shift+B
Result:
Shows Error message Build Error
. I don't see any specific errors being reported in the bottom status ribbon.
After updating purescript to 0.11, VSC complains about Couldn't find psc-ide-server, check PATH. Looked for: psc-ide-server in PATH: ....
I am guessing this has to do with purescript/purescript#2745 ?
Weird stuff happens when you apply them multiple times...
Need to remove them after applying fix.
I'm sure these will be broken, in particular the replacement range for _
suggestion and newlines changed.
Discussed #13; not clear how well this can match psc output format but certainly could be worth a try.
Downside of this is JSON compiler output as processed by PureScript specific build command can power quick-fix functionality, give metadata
build:purs
script.These might also apply to the Build package when I used Atom.
I work on a large project (which has somewhat high cost to reload, 2-3s). Everytime I save and recompile, it also issues a load
command. And then every so often it seems like it decides that it needs to issue a load
command for every file open in the project. I think the arguments sent are incorrect according to https://github.com/purescript/purescript/blob/master/psc-ide-server/PROTOCOL.md#load. Maybe since it is sending dependencies
instead of modules
, it is reloading everything from disk? Not sure. I think psc-ide-server
must be handling these requests one at a time, because it can take a while :). Anyway, here is a log after saving a single file
[Debug] {"params":{"file":"/Users/nathan/Sites/slamdata/slamdata/src/SlamData/Workspace/Card/Component.purs"},"command":"rebuild"} @(main:Main psc-ide-server/Main.hs:170:9)
Reloaded File at: /Users/nathan/Sites/slamdata/slamdata/output/SlamData.Workspace.Card.Component/externs.json
[Debug] Setting Rebuild cache: SlamData.Workspace.Card.Component @(pures_8jj4hUyQwQtHLLXzhSQyGW:Language.PureScript.Ide.Rebuild src/Language/PureScript/Ide/Rebuild.hs:94:9)
[perf] Command Rebuild took 1266.56ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Card.Component"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage2 in 0.00ms
[perf] Command Load took 2637.60ms
[perf] Finished populating Stage3 in 0.00ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"file":"/Users/nathan/Sites/slamdata/slamdata/src/SlamData/Workspace/Card/Component.purs","type":"import"},"command":"list"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Command List took 7.88ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Card.Component.State"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Command Load took 2369.80ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Eval.Persistence"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage2 in 0.05ms
[perf] Finished populating Stage3 in 0.96ms
[perf] Command Load took 2280.72ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Deck.Component"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage2 in 0.01ms
[perf] Finished populating Stage3 in 2.16ms
[perf] Finished populating Stage2 in 0.00ms
[perf] Command Load took 2337.57ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["Control.Monad.Aff.EventLoop"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage3 in 0.00ms
[perf] Finished populating Stage2 in 0.00ms
[perf] Command Load took 2207.99ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Deck.Component"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage3 in 0.22ms
[perf] Finished populating Stage2 in 0.00ms
[perf] Command Load took 2020.27ms
[perf] Finished populating Stage3 in 0.01ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Eval.Persistence"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage2 in 0.01ms
[perf] Finished populating Stage3 in 0.00ms
[perf] Command Load took 2426.35ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"file":"/Users/nathan/Sites/slamdata/slamdata/src/SlamData/Workspace/Card/Component/State.purs","type":"import"},"command":"list"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Command List took 12.37ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Card.Component.State"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage2 in 0.01ms
[perf] Command Load took 1941.34ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Card.Component"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage3 in 0.22ms
[perf] Finished populating Stage2 in 0.01ms
[perf] Command Load took 2066.34ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Eval"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage3 in 0.00ms
[perf] Command Load took 2374.99ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Eval.Deck"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage2 in 0.05ms
[perf] Finished populating Stage3 in 0.01ms
[perf] Finished populating Stage2 in 0.00ms
[perf] Command Load took 1971.95ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"file":"/Users/nathan/Sites/slamdata/slamdata/src/SlamData/Workspace/Eval/Persistence.purs","type":"import"},"command":"list"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage3 in 0.50ms
[perf] Command List took 43.56ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Card.Common"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage2 in 0.01ms
[perf] Command Load took 2050.43ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Deck.Slider"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage3 in 0.22ms
[perf] Finished populating Stage2 in 0.00ms
[perf] Command Load took 2098.16ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"dependencies":["SlamData.Workspace.Deck.Component.Render"],"modules":[]},"command":"load"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage3 in 0.23ms
[perf] Command Load took 2428.36ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"file":"/Users/nathan/Sites/slamdata/slamdata/src/SlamData/Workspace/Deck/Component.purs","type":"import"},"command":"list"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Finished populating Stage2 in 0.01ms
[perf] Finished populating Stage3 in 0.05ms
[perf] Command List took 45.11ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"file":"/Users/nathan/Sites/slamdata/slamdata/src/Control/Monad/Aff/EventLoop.purs","type":"import"},"command":"list"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Command List took 3.79ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"file":"/Users/nathan/Sites/slamdata/slamdata/src/SlamData/Workspace/Deck/Component.purs","type":"import"},"command":"list"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Command List took 28.57ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"file":"/Users/nathan/Sites/slamdata/slamdata/src/SlamData/Workspace/Eval/Persistence.purs","type":"import"},"command":"list"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Command List took 33.27ms
[Debug] Accepted a connection @(main:Main psc-ide-server/Main.hs:160:5)
[Debug] {"params":{"file":"/Users/nathan/Sites/slamdata/slamdata/src/SlamData/Workspace/Card/Component/State.purs","type":"import"},"command":"list"} @(main:Main psc-ide-server/Main.hs:170:9)
[perf] Command List took 14.15ms
As per atom version, it's painful to go back to not having this.
No API for this just now, tracked at microsoft/vscode#6874
Add this based on psc-ide per atom package. Support from VSCode is there https://code.visualstudio.com/docs/extensionAPI/vscode-api#DefinitionProvider.
I guess I rely on autocomplete a lot.
I was wondering if we could have this same behavior from the Atom IDE:
nwolverson/atom-ide-purescript@c1f4ec2
Because I can't get autocomplete on any of my non-top-level symbols otherwise.
Thanks!
In order to be more consistent I renamed the psc-ide exectuable into psc-ide-client. This will take effect with the purescript-0.8.1 release.
Not sure exactly what is desirable here, comments please!
I have ported the agda input method to vscode and made it available in the vscode-input-assist extension. If I recall correctly, the Atom mode has some sort of latex input for unicode so maybe it would be worth adding this extension to the dependencies here to have feature parity.
If you think it is worth adding the dependency, it would be best to change the wordPattern
to something like this.
The extended wordPattern
is needed due to how the vscode completion algorithm works. Without it, some completions like \<=>n
(⇎) cannot be typed because the completion widget will close as soon as a non-word character is typed after \
.
Hi,
One feature that I use frequently is running the main
command within the IDE. An example of this is shown here(after 0:38).
I got something similar hacky using a task runner running pulp run
. But I see that if one right clicks on the purs
file, one sees the option Run Code
. When I click on that, I get the info
message Code language not supported or defined.
I was wondering what you thought of binding that to a behaviour which runs the main
command in the file where it was executed. Would this fall under the vscode-ide-purescript
project or is it external to it?
Think it is exiting ok otherwise but definitely sticking around on windows.
I just get this error when I open vscode
Couldn't find psc-ide-server, check PATH. Looked for: psc-ide-server in PATH:
How do I add psc-ide-server
to the path? I don't even know where it is supposed to be installed by the purescript compiler.
I downloaded purescript and pulp today from npm so I have no idea why I get this error. I can't get the deprecated psc-ide to build in stack either.
Any suggestions? What other info do you need?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.