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

remove hardcoded language server ports #42

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .storybook/middleware.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { createProxyMiddleware } = require("http-proxy-middleware");

module.exports = function (router) {
// local dev
router.use(
createProxyMiddleware(
[
Expand All @@ -22,4 +23,40 @@ module.exports = function (router) {
}
)
);

// to test language server locally
router.use(
"/lsp/**",
createProxyMiddleware({
target: "http://localhost:3333",
ws: true,
logLevel: "error",
secure: false,
changeOrigin: true,
})
);

// using movai-flow dev
// router.use(
// createProxyMiddleware(
// [
// "/token-auth/**",
// "/api/**",
// "/token-verify/**",
// "/token-refresh/**",
// "/domains/**",
// "/ws/**",
// "/static/maps/**",
// "/static/meshes/**",
// "/static/point_clouds/**",
// "/lsp/**",
// ],
// {
// target: "http://localhost:8080",
// ws: true,
// logLevel: "error",
// secure: false,
// }
// )
// );
};
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1.0.8

- [FP-2050 : Change Language Server base URL](https://movai.atlassian.net/browse/FP-2050)
7 changes: 2 additions & 5 deletions src/components/MonacoCodeEditor/hooks/useMonacoEditorCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import * as monaco from "monaco-editor";
import normalizeUrl from "normalize-url";
import { useCallback, useEffect } from "react";
import ReconnectingWebSocket from "reconnecting-websocket";
import { PORT, SERVER_PATH } from "../../../constants/Constants";

//========================================================================================
/* *
Expand Down Expand Up @@ -39,9 +38,7 @@ self.MonacoEnvironment = {

const createUrl = () => {
const protocol = location.protocol === "https:" ? "wss" : "ws";
return normalizeUrl(
`${protocol}://${location.hostname}:${PORT}/${SERVER_PATH}`
);
return normalizeUrl(`${protocol}://${location.host}/lsp/languageServer`);
};

const createWebSocket = (url) => {
Expand Down Expand Up @@ -83,7 +80,7 @@ async function getBuiltins() {
* @returns {undefined}
*/
function sendBuiltins2LanguageServer(builtins) {
const lsBuiltinsAddress = `${location.protocol}//${location.hostname}:${PORT}/builtins`;
const lsBuiltinsAddress = `${location.protocol}//${location.host}/lsp/builtins`;
const builtinsJson = Object.values(builtins).map(({ label }) => ({
label: label,
}));
Expand Down
2 changes: 0 additions & 2 deletions src/constants/Constants.js

This file was deleted.